summaryrefslogtreecommitdiffstats
path: root/wp-admin/menu.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-08-15 12:50:53 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-08-15 12:50:53 +0000
commit62a85df302a839177400100c6a09813161440ce0 (patch)
tree1ab9ca1d6a48defe1d6b8cfff402a0ccf23eca7e /wp-admin/menu.php
parent69a120282949dc8a5526a7486751bc07aea44d9d (diff)
downloadwordpress-mu-62a85df302a839177400100c6a09813161440ce0.tar.gz
wordpress-mu-62a85df302a839177400100c6a09813161440ce0.tar.xz
wordpress-mu-62a85df302a839177400100c6a09813161440ce0.zip
WP Merge to rev 4096
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@722 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/menu.php')
-rw-r--r--wp-admin/menu.php46
1 files changed, 25 insertions, 21 deletions
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index 85719a8..05067af 100644
--- a/wp-admin/menu.php
+++ b/wp-admin/menu.php
@@ -72,8 +72,6 @@ foreach ($menu as $menu_page) {
$admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
}
-do_action('admin_menu', '');
-
// Loop over submenus and remove pages for which the user does not have privs.
foreach ($submenu as $parent => $sub) {
foreach ($sub as $index => $data) {
@@ -88,10 +86,33 @@ foreach ($submenu as $parent => $sub) {
}
// Loop over the top-level menu.
-// Remove menus that have no accessible submenus and require privs that the user does not have.
// Menus for which the original parent is not acessible due to lack of privs will have the next
// submenu in line be assigned as the new menu parent.
foreach ( $menu as $id => $data ) {
+ if ( empty($submenu[$data[2]]) )
+ continue;
+ $subs = $submenu[$data[2]];
+ $first_sub = array_shift($subs);
+ $old_parent = $data[2];
+ $new_parent = $first_sub[2];
+ // If the first submenu is not the same as the assigned parent,
+ // make the first submenu the new parent.
+ if ( $new_parent != $old_parent ) {
+ $real_parent_file[$old_parent] = $new_parent;
+ $menu[$id][2] = $new_parent;
+
+ foreach ($submenu[$old_parent] as $index => $data) {
+ $submenu[$new_parent][$index] = $submenu[$old_parent][$index];
+ unset($submenu[$old_parent][$index]);
+ }
+ unset($submenu[$old_parent]);
+ }
+}
+
+do_action('admin_menu', '');
+
+// Remove menus that have no accessible submenus and require privs that the user does not have.
+foreach ( $menu as $id => $data ) {
// If submenu is empty...
if ( empty($submenu[$data[2]]) ) {
// And user doesn't have privs, remove menu.
@@ -99,24 +120,7 @@ foreach ( $menu as $id => $data ) {
$menu_nopriv[$data[2]] = true;
unset($menu[$id]);
}
- } else {
- $subs = $submenu[$data[2]];
- $first_sub = array_shift($subs);
- $old_parent = $data[2];
- $new_parent = $first_sub[2];
- // If the first submenu is not the same as the assigned parent,
- // make the first submenu the new parent.
- if ( $new_parent != $old_parent ) {
- $real_parent_file[$old_parent] = $new_parent;
- $menu[$id][2] = $new_parent;
-
- foreach ($submenu[$old_parent] as $index => $data) {
- $submenu[$new_parent][$index] = $submenu[$old_parent][$index];
- unset($submenu[$old_parent][$index]);
- }
- unset($submenu[$old_parent]);
- }
- }
+ }
}
get_currentuserinfo();