diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-08-17 12:36:23 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-08-17 12:36:23 +0000 |
commit | e9261c6491959b5b0efe1036ec37ff9e850bd62e (patch) | |
tree | b0ca05cf207206ab1ec85216c0d7abc4c16eca5b /wp-admin/menu.php | |
parent | 62a85df302a839177400100c6a09813161440ce0 (diff) | |
download | wordpress-mu-e9261c6491959b5b0efe1036ec37ff9e850bd62e.tar.gz wordpress-mu-e9261c6491959b5b0efe1036ec37ff9e850bd62e.tar.xz wordpress-mu-e9261c6491959b5b0efe1036ec37ff9e850bd62e.zip |
WP Merge to rev 4104
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@723 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/menu.php')
-rw-r--r-- | wp-admin/menu.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 05067af..3ed8e6f 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -47,6 +47,7 @@ $submenu['link-manager.php'][10] = array(__('Add Link'), 'manage_links', 'link-a $submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'link-import.php'); if ( current_user_can('edit_users') ) { + $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php. $submenu['users.php'][5] = array(__('Authors & Users'), 'edit_users', 'users.php'); $submenu['users.php'][10] = array(__('Your Profile'), 'read', 'profile.php'); } else { @@ -72,12 +73,14 @@ foreach ($menu as $menu_page) { $admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]); } +$_wp_submenu_nopriv = array(); +$_wp_menu_nopriv = array(); // Loop over submenus and remove pages for which the user does not have privs. foreach ($submenu as $parent => $sub) { foreach ($sub as $index => $data) { if ( ! current_user_can($data[1]) ) { - $menu_nopriv[$data[2]] = true; unset($submenu[$parent][$index]); + $_wp_submenu_nopriv[$parent][$data[2]] = true; } } @@ -98,29 +101,31 @@ foreach ( $menu as $id => $data ) { // 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; + $_wp_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]); + unset($submenu[$old_parent]); + $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent]; } } do_action('admin_menu', ''); // Remove menus that have no accessible submenus and require privs that the user does not have. +// Run re-parent loop again. foreach ( $menu as $id => $data ) { // If submenu is empty... if ( empty($submenu[$data[2]]) ) { // And user doesn't have privs, remove menu. if ( ! current_user_can($data[1]) ) { - $menu_nopriv[$data[2]] = true; + $_wp_menu_nopriv[$data[2]] = true; unset($menu[$id]); } - } + } } get_currentuserinfo(); |