From 5c12afb4e1291c10a4932fcda35033e761017bc1 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Sat, 19 Aug 2017 10:38:50 +0000 Subject: [PATCH] Multisite: Use correct capability for the Updates page in the network admin. A user should not be required to have the `update_core` capability to access the Updates page. Having one of the update capabilities for core, plugins, themes and languages should be sufficient. Fixes #41538. git-svn-id: https://develop.svn.wordpress.org/trunk@41269 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/network/menu.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/network/menu.php b/src/wp-admin/network/menu.php index e4cc786cc7..e21deb8b94 100644 --- a/src/wp-admin/network/menu.php +++ b/src/wp-admin/network/menu.php @@ -12,13 +12,25 @@ $menu[2] = array(__('Dashboard'), 'manage_network', 'index.php', '', 'menu-top m $submenu['index.php'][0] = array( __( 'Home' ), 'read', 'index.php' ); +if ( current_user_can( 'update_core' ) ) { + $cap = 'update_core'; +} elseif ( current_user_can( 'update_plugins' ) ) { + $cap = 'update_plugins'; +} elseif ( current_user_can( 'update_themes' ) ) { + $cap = 'update_themes'; +} else { + $cap = 'update_languages'; +} + $update_data = wp_get_update_data(); if ( $update_data['counts']['total'] ) { - $submenu['index.php'][10] = array( sprintf( __( 'Updates %s' ), "" . number_format_i18n( $update_data['counts']['total'] ) . "" ), 'update_core', 'update-core.php' ); + $submenu['index.php'][10] = array( sprintf( __( 'Updates %s' ), "" . number_format_i18n( $update_data['counts']['total'] ) . "" ), $cap, 'update-core.php' ); } else { - $submenu['index.php'][10] = array( __( 'Updates' ), 'update_core', 'update-core.php' ); + $submenu['index.php'][10] = array( __( 'Updates' ), $cap, 'update-core.php' ); } +unset( $cap ); + $submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'upgrade_network', 'upgrade.php' ); $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );