WordPress.org

Make WordPress Core

Ticket #25219: 25219.4.diff

File 25219.4.diff, 22.6 KB (added by iandunn, 6 years ago)

Refresh

  • src/wp-admin/includes/theme.php

     
    124124 */
    125125function get_theme_update_available( $theme ) {
    126126        static $themes_update;
    127 
    128         if ( !current_user_can('update_themes' ) )
     127       
     128        if ( ! current_user_can( 'view_theme_updates' ) ) {
    129129                return false;
    130 
     130        }
     131       
    131132        if ( !isset($themes_update) )
    132133                $themes_update = get_site_transient('update_themes');
    133134
     
    396397        }
    397398
    398399        $updates = array();
    399         if ( current_user_can( 'update_themes' ) ) {
     400        if ( current_user_can( 'view_theme_updates' ) ) {
    400401                $updates_transient = get_site_transient( 'update_themes' );
    401402                if ( isset( $updates_transient->response ) ) {
    402403                        $updates = $updates_transient->response;
  • src/wp-admin/includes/update.php

     
    162162}
    163163
    164164function core_update_footer( $msg = '' ) {
    165         if ( !current_user_can('update_core') )
     165        if ( ! current_user_can( 'view_core_updates' ) )
    166166                return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
    167167
    168168        $cur = get_preferred_from_update_core();
     
    184184        break;
    185185
    186186        case 'upgrade' :
    187                 return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( 'update-core.php' ), $cur->current);
     187                if ( current_user_can( 'update_core' ) ) {
     188                        return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( 'update-core.php' ), $cur->current);
     189                } else {
     190                        return sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please update now.'), $cur->current );
     191                }
    188192        break;
    189193
    190194        case 'latest' :
     
    211215
    212216        if ( current_user_can('update_core') ) {
    213217                $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) );
     218        } elseif ( current_user_can( 'view_core_updates' ) ) {
     219                $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please update now.'), $cur->current );
    214220        } else {
    215221                $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
    216222        }
     
    223229function update_right_now_message() {
    224230        $msg = sprintf( __( 'You are using <span class="b">WordPress %s</span>.' ), get_bloginfo( 'version', 'display' ) );
    225231
    226         if ( current_user_can('update_core') ) {
     232        if ( current_user_can( 'view_core_updates' ) ) {
    227233                $cur = get_preferred_from_update_core();
    228234
    229                 if ( isset( $cur->response ) && $cur->response == 'upgrade' )
    230                         $msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
     235                if ( isset( $cur->response ) && $cur->response == 'upgrade' ) {
     236                        if ( current_user_can( 'update_core' ) ) {
     237                                $msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
     238                        } else {
     239                                $msg .= ' ' . sprintf( __( '<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please update now.' ), $cur->current );
     240                        }
     241                }
    231242        }
    232243
    233244        echo "<span id='wp-version-message'>$msg</span>";
     
    248259}
    249260
    250261function wp_plugin_update_rows() {
    251         if ( !current_user_can('update_plugins' ) )
     262        if ( ! current_user_can( 'view_plugin_updates' ) ) {
    252263                return;
     264        }
    253265
    254266        $plugins = get_site_transient( 'update_plugins' );
    255267        if ( isset($plugins->response) && is_array($plugins->response) ) {
  • src/wp-admin/menu.php

     
    3434        $update_data = wp_get_update_data();
    3535
    3636if ( ! is_multisite() ) {
    37         if ( current_user_can( 'update_core' ) )
    38                 $cap = 'update_core';
    39         elseif ( current_user_can( 'update_plugins' ) )
    40                 $cap = 'update_plugins';
     37        if ( current_user_can( 'view_core_updates' ) )
     38                $cap = 'view_core_updates';
     39        elseif ( current_user_can( 'view_plugin_updates' ) )
     40                $cap = 'view_plugin_updates';
    4141        else
    42                 $cap = 'update_themes';
     42                $cap = 'view_theme_updates';
    4343        $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php');
    4444        unset( $cap );
    4545}
     
    161161}
    162162
    163163$count = '';
    164 if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
     164if ( ! is_multisite() && current_user_can( 'view_plugin_updates' ) ) {
    165165        if ( ! isset( $update_data ) )
    166166                $update_data = wp_get_update_data();
    167167        $count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
     
    173173
    174174        if ( ! is_multisite() ) {
    175175                /* translators: add new plugin */
    176                 $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' );
     176                $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'view_plugin_updates', 'plugin-install.php' );
    177177                $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
    178178        }
    179179
  • src/wp-admin/plugin-install.php

     
    1414 */
    1515require_once( dirname( __FILE__ ) . '/admin.php' );
    1616
    17 if ( ! current_user_can('install_plugins') )
    18         wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
     17if ( ! current_user_can( 'view_plugin_updates' ) )
     18        wp_die( __( 'You do not have sufficient permissions to view plugin updates for this site.' ) );
    1919
    2020if ( is_multisite() && ! is_network_admin() ) {
    2121        wp_redirect( network_admin_url( 'plugin-install.php' ) );
  • src/wp-admin/update-core.php

     
    1818        exit();
    1919}
    2020
    21 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
    22         wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     21if ( ! current_user_can( 'view_core_updates' ) && ! current_user_can( 'view_theme_updates' ) && ! current_user_can( 'view_plugin_updates' ) )
     22        wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) );
    2323
    2424function list_core_update( $update ) {
    2525        global $wp_local_package, $wpdb, $wp_version;
     
    6262                                $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
    6363                        elseif ( !$mysql_compat )
    6464                                $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
    65                         else
    66                                 $message =      sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
     65                        else {
     66                                if ( current_user_can( 'update_core' ) ) {
     67                                        $message = sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
     68                                } else {
     69                                        $message = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> is available. Please download the package and install it manually.'), $update->current, $version_string);
     70                                }
     71                        }
    6772                        if ( !$mysql_compat || !$php_compat )
    6873                                $show_buttons = false;
    6974                }
     
    7984        echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
    8085        echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
    8186        if ( $show_buttons ) {
    82                 if ( $first_pass ) {
    83                         submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
    84                         $first_pass = false;
    85                 } else {
    86                         submit_button( $submit, 'button', 'upgrade', false );
     87                if ( current_user_can( 'update_core' ) ) {
     88                        if ( $first_pass ) {
     89                                submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
     90                                $first_pass = false;
     91                        } else {
     92                                submit_button( $submit, 'button', 'upgrade', false );
     93                        }
     94                        echo '&nbsp;';
    8795                }
    88                 echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
     96                echo '<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
    8997        }
    9098        if ( 'en_US' != $update->locale )
    9199                if ( !isset( $update->dismissed ) || !$update->dismissed )
     
    186194        }
    187195        echo '</ul>';
    188196        // Don't show the maintenance mode notice when we are only showing a single re-install option.
    189         if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
     197        if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) && current_user_can( 'update_core' ) ) {
    190198                echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
    191199        } elseif ( ! $updates ) {
    192200                list( $normalized_version ) = explode( '-', $wp_version );
     
    216224                $core_update_version = $core_updates[0]->current;
    217225        ?>
    218226<h3><?php _e( 'Plugins' ); ?></h3>
    219 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
    220 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
    221 <?php wp_nonce_field('upgrade-core'); ?>
    222 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
     227<p>
     228        <?php _e( 'The following plugins have new versions available.' ); ?>
     229        <?php if ( current_user_can( 'update_plugins' ) ) : ?>
     230                <?php _e( 'Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?>
     231        <?php endif; ?>
     232</p>
     233
     234<?php if ( current_user_can( 'update_plugins' ) ) : ?>
     235        <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
     236        <?php wp_nonce_field('upgrade-core'); ?>
     237        <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
     238<?php endif; ?>
     239
    223240<table class="widefat" id="update-plugins-table">
    224         <thead>
    225         <tr>
    226                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th>
    227                 <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th>
    228         </tr>
    229         </thead>
    230 
    231         <tfoot>
    232         <tr>
    233                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th>
    234                 <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th>
    235         </tr>
    236         </tfoot>
     241        <?php if ( current_user_can( 'update_plugins' ) ) : ?>
     242                <thead>
     243                <tr>
     244                        <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th>
     245                        <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th>
     246                </tr>
     247                </thead>
     248       
     249                <tfoot>
     250                <tr>
     251                        <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th>
     252                        <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th>
     253                </tr>
     254                </tfoot>
     255        <?php endif; ?>
     256       
    237257        <tbody class="plugins">
    238258<?php
    239259        foreach ( (array) $plugins as $plugin_file => $plugin_data) {
     
    267287                $details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version);
    268288                $details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text);
    269289
    270                 echo "
    271         <tr>
    272                 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
    273                 <td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td>
    274         </tr>";
     290                ?>
     291                        <tr>
     292                                <?php if ( current_user_can( 'update_plugins' ) ) : ?>
     293                                        <th scope="row" class="check-column"><input type="checkbox" name="checked[]" value="<?php esc_attr_e( $plugin_file ); ?>" /></th>
     294                                <?php endif; ?>
     295                               
     296                                <td>
     297                                        <p>
     298                                                <strong><?php echo $plugin_data->Name; ?></strong><br />
     299                                                <?php printf( __( 'You have version %s installed.' ), $plugin_data->Version ); ?>
     300                                               
     301                                                <?php if ( current_user_can( 'update_plugins' ) ) : ?>
     302                                                        <?php printf( __( 'Update to %s.' ), $plugin_data->update->new_version ); ?>
     303                                                <?php else : ?>
     304                                                        <?php printf( __( '%s is available.' ), $plugin_data->update->new_version ); ?>
     305                                                <?php endif; ?>
     306                                               
     307                                                <?php echo $details . $compat . $upgrade_notice; ?>
     308                                        </p>
     309                                </td>
     310                        </tr>
     311                <?php
    275312        }
    276313?>
    277314        </tbody>
    278315</table>
    279 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
    280 </form>
    281 <?php
     316
     317<?php if ( current_user_can( 'update_plugins' ) ) : ?>
     318        <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
     319        </form>
     320<?php endif;
    282321}
    283322
    284323function list_theme_updates() {
     
    293332
    294333?>
    295334<h3><?php _e( 'Themes' ); ?></h3>
    296 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
    297 <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'http://codex.wordpress.org/Child_Themes' ) ); ?></p>
    298 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
    299 <?php wp_nonce_field('upgrade-core'); ?>
    300 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
     335<p>
     336        <?php _e( 'The following themes have new versions available.' ); ?>
     337        <?php if ( current_user_can( 'update_themes' ) ) : ?>
     338                <?php _e( 'Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?>
     339        <?php endif; ?>
     340</p>
     341
     342<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost during an update. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'http://codex.wordpress.org/Child_Themes' ) ); ?></p>
     343
     344<?php if ( current_user_can( 'update_themes' ) ) : ?>
     345        <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
     346        <?php wp_nonce_field('upgrade-core'); ?>
     347        <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
     348<?php endif; ?>
     349
    301350<table class="widefat" id="update-themes-table">
    302         <thead>
    303         <tr>
    304                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th>
    305                 <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th>
    306         </tr>
    307         </thead>
     351        <?php if ( current_user_can( 'update_themes' ) ) : ?>
     352                <thead>
     353                <tr>
     354                        <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th>
     355                        <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th>
     356                </tr>
     357                </thead>
     358       
     359                <tfoot>
     360                <tr>
     361                        <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th>
     362                        <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th>
     363                </tr>
     364                </tfoot>
     365        <?php endif; ?>
    308366
    309         <tfoot>
    310         <tr>
    311                 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th>
    312                 <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th>
    313         </tr>
    314         </tfoot>
    315367        <tbody class="plugins">
    316368<?php
    317369        foreach ( $themes as $stylesheet => $theme ) {
    318                 echo "
    319         <tr>
    320                 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th>
    321                 <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
    322         </tr>";
     370                ?>
     371               
     372                <tr>
     373                        <th scope="row" class="check-column"><input type="checkbox" name="checked[]" value="<?php esc_attr_e( $stylesheet ); ?>" /></th>
     374                        <td class="plugin-title">
     375                                <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" style="float: left; padding: 0 5px 5px;" />
     376                                <strong><?php echo $theme->display('Name'); ?></strong>
     377                                <?php printf( __( 'You have version %s installed.' ), $theme->display('Version') ); ?>
     378                               
     379                                <?php if ( current_user_can( 'update_themes' ) ) : ?>
     380                                        <?php printf( __( 'Update to %s.' ), $theme->update['new_version'] ); ?>
     381                                <?php else : ?>
     382                                        <?php printf( __( '%s is available.' ), $theme->update['new_version'] ); ?>
     383                                <?php endif; ?>
     384                        </td>
     385                </tr>
     386               
     387                <?php
    323388        }
    324389?>
    325390        </tbody>
    326391</table>
    327 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
    328 </form>
    329 <?php
     392
     393<?php if ( current_user_can( 'update_themes' ) ) : ?>
     394        <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
     395        </form>
     396<?php endif;
    330397}
    331398
    332399function list_translation_updates() {
     
    512579        echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
    513580        echo '</p>';
    514581
    515         if ( $core = current_user_can( 'update_core' ) )
     582        if ( $core = current_user_can( 'view_core_updates' ) )
    516583                core_upgrade_preamble();
    517         if ( $plugins = current_user_can( 'update_plugins' ) )
     584        if ( $plugins = current_user_can( 'view_plugin_updates' ) )
    518585                list_plugin_updates();
    519         if ( $themes = current_user_can( 'update_themes' ) )
     586        if ( $themes = current_user_can( 'view_theme_updates' ) )
    520587                list_theme_updates();
    521588        if ( $core || $plugins || $themes )
    522589                list_translation_updates();
     
    532599
    533600} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
    534601
    535         if ( ! current_user_can( 'update_core' ) )
    536                 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     602        if ( ! current_user_can( 'view_core_updates' ) )
     603                wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) );
    537604
    538605        check_admin_referer('upgrade-core');
    539606
     
    557624
    558625} elseif ( 'do-plugin-upgrade' == $action ) {
    559626
    560         if ( ! current_user_can( 'update_plugins' ) )
    561                 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     627        if ( ! current_user_can( 'view_plugin_updates' ) )
     628                wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) );
    562629
    563630        check_admin_referer('upgrade-core');
    564631
     
    585652
    586653} elseif ( 'do-theme-upgrade' == $action ) {
    587654
    588         if ( ! current_user_can( 'update_themes' ) )
    589                 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     655        if ( ! current_user_can( 'view_theme_updates' ) )
     656                wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) );
    590657
    591658        check_admin_referer('upgrade-core');
    592659
  • src/wp-includes/capabilities.php

     
    12741274                else
    12751275                        $caps[] = $cap;
    12761276                break;
     1277        case 'view_plugin_updates':
     1278        case 'view_theme_updates':
     1279        case 'view_core_updates':
     1280                if ( is_multisite() && ! is_super_admin( $user_id ) )
     1281                        $caps[] = 'do_not_allow';
     1282                else
     1283                        $caps[] = 'manage_options';
     1284                break;
    12771285        case 'activate_plugins':
    12781286                $caps[] = $cap;
    12791287                if ( is_multisite() ) {
  • src/wp-includes/update.php

     
    470470function wp_get_update_data() {
    471471        $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 );
    472472
    473         if ( $plugins = current_user_can( 'update_plugins' ) ) {
     473        if ( $plugins = current_user_can( 'view_plugin_updates' ) ) {
    474474                $update_plugins = get_site_transient( 'update_plugins' );
    475475                if ( ! empty( $update_plugins->response ) )
    476476                        $counts['plugins'] = count( $update_plugins->response );
    477477        }
    478478
    479         if ( $themes = current_user_can( 'update_themes' ) ) {
     479        if ( $themes = current_user_can( 'view_theme_updates' ) ) {
    480480                $update_themes = get_site_transient( 'update_themes' );
    481481                if ( ! empty( $update_themes->response ) )
    482482                        $counts['themes'] = count( $update_themes->response );
    483483        }
    484484
    485         if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) {
     485        if ( ( $core = current_user_can( 'view_core_updates' ) ) && function_exists( 'get_core_updates' ) ) {
    486486                $update_wordpress = get_core_updates( array('dismissed' => false) );
    487                 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') )
     487                if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ) ) && current_user_can( 'view_core_updates' ) )
    488488                        $counts['wordpress'] = 1;
    489489        }
    490490