mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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/trunk@12738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c2873bbab3
commit
795ce48b83
@ -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]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user