Check menu privs after plugins add their menus. fixes #2696

git-svn-id: http://svn.automattic.com/wordpress/trunk@3756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-05-02 19:08:37 +00:00
parent 2b49e833c7
commit 1008282133

View File

@ -48,6 +48,13 @@ $submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
$submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php');
// Create list of page plugin hook names.
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) {
@ -93,12 +100,6 @@ foreach ( $menu as $id => $data ) {
}
}
// Create list of page plugin hook names.
foreach ($menu as $menu_page) {
$admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
}
do_action('admin_menu', '');
ksort($menu); // make it all pretty
if (! user_can_access_admin_page()) {