summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index b5a64af25..367369dcb 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1787,8 +1787,11 @@ function _menu_navigation_links_rebuild($menu) {
$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'));
if ($existing_item) {
$item['mlid'] = $existing_item['mlid'];
- $item['menu_name'] = $existing_item['menu_name'];
- $item['plid'] = $existing_item['plid'];
+ // A change in hook_menu may move the link to a different menu
+ if (empty($item['menu_name']) || ($item['menu_name'] == $existing_item['menu_name'])) {
+ $item['menu_name'] = $existing_item['menu_name'];
+ $item['plid'] = $existing_item['plid'];
+ }
$item['has_children'] = $existing_item['has_children'];
$item['updated'] = $existing_item['updated'];
}