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.

Built from https://develop.svn.wordpress.org/trunk@41269


git-svn-id: http://core.svn.wordpress.org/trunk@41109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2017-08-19 10:39:44 +00:00
parent f6ebc1a80c
commit 755a926b65
2 changed files with 15 additions and 3 deletions

View File

@ -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' ), "<span class='update-plugins count-{$update_data['counts']['total']}'><span class='update-count'>" . number_format_i18n( $update_data['counts']['total'] ) . "</span></span>" ), 'update_core', 'update-core.php' );
$submenu['index.php'][10] = array( sprintf( __( 'Updates %s' ), "<span class='update-plugins count-{$update_data['counts']['total']}'><span class='update-count'>" . number_format_i18n( $update_data['counts']['total'] ) . "</span></span>" ), $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' );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41268';
$wp_version = '4.9-alpha-41269';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.