Index: nodeprofile.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodeprofile/nodeprofile.module,v
retrieving revision 1.7.2.3
diff -u -r1.7.2.3 nodeprofile.module
--- nodeprofile.module	28 Mar 2007 16:38:13 -0000	1.7.2.3
+++ nodeprofile.module	28 Mar 2007 21:00:13 -0000
@@ -13,20 +13,43 @@
 function nodeprofile_menu($may_cache) {
   $items = array();
 
-  if ($may_cache && module_exists('usernode')) {
-    // prevent the deletion of the usernode-ct - nodeprofile-ct relation
+  if ($may_cache) {
     $items[] = array(
-      'path' => 'admin/content/nodefamily/'. USERNODE_CONTENT_TYPE,
-      'title' => t('delete relation'),
-      'callback' => 'nodeprofile_keep_relation',
-      'access' => user_access('administer nodes'),
-      'type' => MENU_CALLBACK,
+      'path' => 'admin/user/nodeprofile',
+      'title' => t('Node profile settings'),
+      'description' => t('Configure the display and management of node profiles.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('nodeprofile_admin_settings'),
+      'access' => user_access('administer users'),
     );
+    if (module_exists('usernode')) {
+      // prevent the deletion of the usernode-ct - nodeprofile-ct relation
+      $items[] = array(
+        'path' => 'admin/content/nodefamily/'. USERNODE_CONTENT_TYPE,
+        'title' => t('delete relation'),
+        'callback' => 'nodeprofile_keep_relation',
+        'access' => user_access('administer nodes'),
+        'type' => MENU_CALLBACK,
+      );
+    }
   }
   return $items;
 }
 
 /**
+ * Menu callback; node profile settings.
+ */
+function nodeprofile_admin_settings() {
+  $form['nodeprofile_user_edit_categories'] = array(
+    '#type' => 'checkbox',
+    '#title' => t("Integrate node profiles with user categories."),
+    '#default_value' => variable_get('nodeprofile_user_edit_categories', FALSE),
+    '#description' => t('If checked, the node profiles can be edited like the standard profiles.')
+  );
+  return system_settings_form($form);
+}
+
+/**
  * Menu callback.
  * Hooks into admin/content/nodefamily/usernode which is normally handled by
  * the nodefamily module, but gets special handling here for relations that
@@ -157,7 +180,59 @@
  */
 function nodeprofile_user($op, &$edit, &$account, $category = NULL) {
   switch ($op) {
-    case 'delete':
+    case 'categories':
+      if (variable_get('nodeprofile_user_edit_categories', FALSE)) {
+        foreach (nodeprofile_get_types('types') as $type) {
+          $data[] = array(
+            'name' => $type->type,
+            'title' => $type->name,
+            'weight' => 3
+          );
+        }
+        return $data;
+      }
+      break;
+    case 'form':
+      if (variable_get('nodeprofile_user_edit_categories', FALSE) && is_nodeprofile($category)) {
+        $type = $category;
+        $node = node_load(array('type' => $type, 'uid' => $account->uid));
+        if (!$node) {
+          $node = array('uid' => $account->uid, 'name' => $account->name, 'type' => $type);
+        }
+        $fields[$category] = node_form($node);
+        $fields[$category]['log']['#access'] = 0;
+        $fields[$category]['author']['#access'] = 0;
+        $fields[$category]['options']['#access'] = 0;
+        unset($fields[$category]['preview']);
+        unset($fields[$category]['submit']);
+        unset($fields[$category]['delete']);
+        return $fields;
+      }
+      break;
+
+    case 'update':
+      if (variable_get('nodeprofile_user_edit_categories', FALSE) && is_nodeprofile($category)) {
+        $type = $category;
+        $node = node_submit($edit);
+        unset($edit);
+        node_save($node);
+      }
+      break;
+
+    case 'view':
+      $fields = array();
+      foreach (nodeprofile_get_types('types') as $type) {
+        if ($node = node_load(array('type' => $type->type, 'uid' => $account->uid))) {
+          $fields[$type->name]['nodeprofile'] = array(
+            'title' => NULL,
+            'value' => node_view($node, FALSE, TRUE, FALSE),
+            'class' => $type->type,
+          );
+        }
+      }
+      return $fields;
+
+    case 'delete':          
       // retrieve profile node types to be deleted
       $typenames = array();
       foreach (node_get_types('names') as $typename => $visiblename) {
@@ -189,9 +264,6 @@
         }
       }
       break;
-
-    default:
-      break;
   }
 }
 
