WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/19/2017 10:38:50 AM (4 years ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/menu.php

    r40404 r41269  
    1313$submenu['index.php'][0] = array( __( 'Home' ), 'read', 'index.php' );
    1414
     15if ( current_user_can( 'update_core' ) ) {
     16    $cap = 'update_core';
     17} elseif ( current_user_can( 'update_plugins' ) ) {
     18    $cap = 'update_plugins';
     19} elseif ( current_user_can( 'update_themes' ) ) {
     20    $cap = 'update_themes';
     21} else {
     22    $cap = 'update_languages';
     23}
     24
    1525$update_data = wp_get_update_data();
    1626if ( $update_data['counts']['total'] ) {
    17     $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' );
     27    $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' );
    1828} else {
    19     $submenu['index.php'][10] = array( __( 'Updates' ), 'update_core', 'update-core.php' );
     29    $submenu['index.php'][10] = array( __( 'Updates' ), $cap, 'update-core.php' );
    2030}
     31
     32unset( $cap );
    2133
    2234$submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'upgrade_network', 'upgrade.php' );
Note: See TracChangeset for help on using the changeset viewer.