Make WordPress Core


Ignore:
Timestamp:
01/18/2010 10:21:36 PM (15 years ago)
Author:
ryan
Message:

Use cap checks instead of multisite and super admin checks. Add some new caps. Merge cleanup. see #11644.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/update.php

    r12752 r12753  
    8383
    8484function core_update_footer( $msg = '' ) {
    85     if ( is_multisite() && !is_super_admin() )
    86         return false;
    87 
    88     if ( !current_user_can('manage_options') )
     85    if ( is_multisite() && !current_user_can('update_core') )
     86        return false;
     87
     88    if ( !current_user_can('update_core') )
    8989        return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
    9090
     
    105105
    106106    case 'upgrade' :
    107         if ( current_user_can('manage_options') ) {
    108             return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
    109             break;
    110         }
     107        return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
     108    break;
    111109
    112110    case 'latest' :
     
    119117
    120118function update_nag() {
    121     if ( is_multisite() && !is_super_admin() )
     119    if ( is_multisite() && !current_user_can('update_core') )
    122120        return false;
    123121
     
    132130        return false;
    133131
    134     if ( current_user_can('manage_options') )
     132    if ( current_user_can('update_core') )
    135133        $msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
    136134    else
     
    143141// Called directly from dashboard
    144142function update_right_now_message() {
    145     if ( is_multisite() && !is_super_admin() )
     143    if ( is_multisite() && !current_user_can('update_core') )
    146144        return false;
    147145
     
    149147
    150148    $msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
    151     if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') )
     149    if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') )
    152150        $msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
    153151
     
    170168
    171169function wp_plugin_update_rows() {
     170    if ( !current_user_can('update_plugins' ) )
     171        return;
     172
    172173    $plugins = get_site_transient( 'update_plugins' );
    173174    if ( isset($plugins->response) && is_array($plugins->response) ) {
     
    206207
    207208function wp_update_plugin($plugin, $feedback = '') {
    208     if ( is_multisite() && !is_super_admin() )
    209         return false;
    210 
    211 
    212209    if ( !empty($feedback) )
    213210        add_filter('update_feedback', $feedback);
     
    235232
    236233function wp_update_theme($theme, $feedback = '') {
    237 
    238234    if ( !empty($feedback) )
    239235        add_filter('update_feedback', $feedback);
     
    246242
    247243function wp_update_core($current, $feedback = '') {
    248 
    249244    if ( !empty($feedback) )
    250245        add_filter('update_feedback', $feedback);
     
    261256        return false;
    262257
    263     if ( current_user_can('manage_options') )
     258    if ( current_user_can('update_core') )
    264259        $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
    265260    else
Note: See TracChangeset for help on using the changeset viewer.