Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.255.2.28 diff -u -p -r1.255.2.28 menu.inc --- includes/menu.inc 9 Feb 2009 16:28:21 -0000 1.255.2.28 +++ includes/menu.inc 22 Mar 2009 20:48:47 -0000 @@ -1727,7 +1727,6 @@ function _menu_navigation_links_rebuild( $menu_links = array(); foreach ($menu as $path => $item) { if ($item['_visible']) { - $item = _menu_link_build($item); $menu_links[$path] = $item; $sort[$path] = $item['_number_parts']; } @@ -1737,7 +1736,7 @@ function _menu_navigation_links_rebuild( array_multisort($sort, SORT_NUMERIC, $menu_links); foreach ($menu_links as $item) { - $existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized, has_children, updated FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", $item['link_path'], 'system')); + $existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized, has_children, updated FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", $item['path'], 'system')); if ($existing_item) { $item['mlid'] = $existing_item['mlid']; // A change in hook_menu may move the link to a different menu @@ -1745,10 +1744,15 @@ function _menu_navigation_links_rebuild( $item['menu_name'] = $existing_item['menu_name']; $item['plid'] = $existing_item['plid']; } + else { + // If it moved, put it at the top level in the new menu. + $item['plid'] = 0; + } $item['has_children'] = $existing_item['has_children']; $item['updated'] = $existing_item['updated']; } if (!$existing_item || !$existing_item['customized']) { + $item = _menu_link_build($item); menu_link_save($item); } }