Permalink
Browse files

Ensure that inaccessible parent menus are marked as such even if they…

… have accessible children. See #11922.

git-svn-id: http://svn.automattic.com/wordpress/branches/2.9@12737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
westi
westi committed Jan 16, 2010
1 parent 9f1619b commit 451711db8f83b70c76fd935d15dc072e07c2a61a
Showing with 4 additions and 2 deletions.
  1. +4 −2 wp-admin/menu.php
View
@@ -198,11 +198,13 @@
// 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 ( ! current_user_can($data[1]) )
+ $_wp_menu_nopriv[$data[2]] = true;
+
// If submenu is empty...
if ( empty($submenu[$data[2]]) ) {
// And user doesn't have privs, remove menu.
- if ( ! current_user_can($data[1]) ) {
- $_wp_menu_nopriv[$data[2]] = true;
+ if ( isset( $_wp_menu_nopriv[$data[2]] ) ) {
unset($menu[$id]);
}
}

0 comments on commit 451711d

Please sign in to comment.