? 507456-section-edit.patch
? 512594-items.patch
Index: menu_node_edit.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/menu_node_edit/menu_node_edit.module,v
retrieving revision 1.7
diff -u -p -r1.7 menu_node_edit.module
--- menu_node_edit.module	1 Jul 2009 18:52:13 -0000	1.7
+++ menu_node_edit.module	8 Jul 2009 15:53:54 -0000
@@ -470,11 +470,13 @@ function menu_node_edit_node_form_alter(
   }
   $items = array();
   $check = array();
-  // Get the section mlids.
-  $result = db_query("SELECT mlid, menu_name FROM {menu_links} WHERE mlid IN (" . db_placeholders($account->menu_node_edit, 'int') . ")", $account->menu_node_edit);
-  while ($data = db_fetch_object($result)) {
-    $items[$data->menu_name][] = $data->mlid;
-    $check[] = $data->mlid;
+  foreach ($account->menu_node_edit as $mlid) {
+    $item = db_fetch_object(db_query("SELECT mlid, menu_name, depth FROM {menu_links} WHERE mlid = %d", $mlid));
+    $result = db_query("SELECT mlid, menu_name FROM {menu_links} WHERE %s= %d", "p$item->depth", $item->mlid);
+    while ($data = db_fetch_object($result)) {
+      $items[$data->menu_name][] = $data->mlid;
+      $check[] = $data->mlid;
+    }
   }
   if (empty($items)) {
     return;
@@ -491,11 +493,11 @@ function menu_node_edit_node_form_alter(
   if (empty($default) && isset($_GET['section']) && in_array($_GET['section'], $check)) {
     $default = $_GET['section'];
   }
-  // Prepare the options for the form.
   $names = menu_get_menus();
   foreach ($items as $menu => $filter) {
     $options[$names[$menu]] = menu_node_tree(menu_tree_all_data($menu), NULL, $filter);
   }
+  // Prepare the options for the form.
   ksort($options);  
   // Set the proper help text.
   $collapsed = FALSE;
