=== modified file 'includes/menu.inc'
--- includes/menu.inc	2007-09-26 18:14:05 +0000
+++ includes/menu.inc	2007-09-28 13:52:47 +0000
@@ -327,15 +327,25 @@ function menu_execute_active_handler($pa
  *   A menu router or menu link item
  * @param $map
  *   An array of path arguments (ex: array('node', '5'))
+ * @param $set
+ *   Do not give this argument, it's for internal use only.
  * @return
  *   Returns TRUE for success, FALSE if an object cannot be loaded
  */
-function _menu_load_objects($item, &$map) {
+function _menu_load_objects($item, &$map, $set = NULL) {
+  static $stored_map, $index;
+  if (isset($set)) {
+    if ($set) {
+      $stored_map = $map;
+    }
+    return array($index, $stored_map);
+  }
   if ($item['load_functions']) {
     $load_functions = unserialize($item['load_functions']);
     $path_map = $map;
     foreach ($load_functions as $index => $function) {
       if ($function) {
+        $stored_map = $map;
         $return = $function(isset($path_map[$index]) ? $path_map[$index] : '');
         // If callback returned an error or there is no callback, trigger 404.
         if ($return === FALSE) {
@@ -343,6 +353,7 @@ function _menu_load_objects($item, &$map
           $map = FALSE;
           return FALSE;
         }
+        $map = $stored_map;
         $map[$index] = $return;
       }
     }
@@ -350,6 +361,15 @@ function _menu_load_objects($item, &$map
   return TRUE;
 }
 
+function menu_get_object_map() {
+  $map = array();
+  return _menu_load_objects(NULL, $map, FALSE);
+}
+
+function menu_set_object_map($map) {
+  _menu_load_objects(NULL, $map, TRUE);
+}
+
 /**
  * Check access to a menu item using the access callback
  *

=== modified file 'modules/user/user.module'
--- modules/user/user.module	2007-09-27 16:52:00 +0000
+++ modules/user/user.module	2007-09-28 13:53:54 +0000
@@ -1050,11 +1050,12 @@ function user_menu() {
     foreach ($categories as $key => $category) {
       // 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
       if ($category['name'] != 'account') {
-        $items['user/%user/edit/'. $category['name']] = array(
+        $items['user/%user_category/edit/'. $category['name']] = array(
           'title callback' => 'check_plain',
           'title arguments' => array($category['title']),
           'page callback' => 'user_edit',
           'page arguments' => array(1, 3),
+          'tab_parent' => 'user/%/edit',
           'type' => MENU_LOCAL_TASK,
           'weight' => $category['weight'],
           'file' => 'user.pages.inc',
@@ -1065,6 +1066,16 @@ function user_menu() {
   return $items;
 }
 
+function user_category_load($uid) {
+  $account = user_load($uid);
+  list($index, $map) = menu_get_object_map();
+  if (count($map) > 3) {
+    $map = array($map[0], $map[1], $map[2], implode('/', array_slice($map, 3)));
+    menu_set_object_map($map);
+  }
+  return $account;
+}
+
 function user_init() {
   drupal_add_css(drupal_get_path('module', 'user') .'/user.css', 'module');
 }

