Ensure that inaccessible parent menus are marked as such even if they have accessible children. See #11922.

git-svn-id: https://develop.svn.wordpress.org/trunk@12738 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2010-01-16 22:59:27 +00:00
parent 6e875ec562
commit 2406039676
1 changed files with 4 additions and 2 deletions

View File

@ -246,11 +246,13 @@ 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 ( ! 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]);
}
}