Make WordPress Core

Changeset 21199


Ignore:
Timestamp:
06/30/2012 12:54:05 PM (14 years ago)
Author:
nacin
Message:

Allow the 'WordPress Updates' page to be accessible even if you cannot update core, as long as you can update plugins or themes. fixes #21124.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r21198 r21199  
    3535
    3636if ( ! is_multisite() ) {
    37     $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>" ), 'update_core',  'update-core.php');
     37    if ( current_user_can( 'update_core' ) )
     38        $cap = 'update_core';
     39    elseif ( current_user_can( 'update_plugins' ) )
     40        $cap = 'update_plugins';
     41    else
     42        $cap = 'update_themes';
     43    $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');
     44    unset( $cap );
    3845}
    3946
  • trunk/wp-admin/update-core.php

    r20894 r21199  
    1919}
    2020
    21 if ( ! current_user_can( 'update_core' ) )
     21if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
    2222    wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
    2323
     
    135135
    136136    $updates = get_core_updates();
    137 ?>
    138     <div class="wrap">
    139     <?php screen_icon('tools'); ?>
    140     <h2><?php _e('WordPress Updates'); ?></h2>
    141 <?php
     137
    142138    if ( $upgrade_error ) {
    143139        echo '<div class="error"><p>';
     
    184180    }
    185181    dismissed_updates();
    186 
    187     if ( current_user_can( 'update_plugins' ) )
    188         list_plugin_updates();
    189     if ( current_user_can( 'update_themes' ) )
    190         list_theme_updates();
    191     do_action('core_upgrade_preamble');
    192     echo '</div>';
    193182}
    194183
     
    455444    wp_version_check();
    456445    require_once(ABSPATH . 'wp-admin/admin-header.php');
    457     core_upgrade_preamble();
     446    ?>
     447    <div class="wrap">
     448    <?php screen_icon('tools'); ?>
     449    <h2><?php _e('WordPress Updates'); ?></h2>
     450    <?php
     451    if ( current_user_can( 'update_core' ) )
     452        core_upgrade_preamble();
     453    if ( current_user_can( 'update_plugins' ) )
     454        list_plugin_updates();
     455    if ( current_user_can( 'update_themes' ) )
     456        list_theme_updates();
     457    do_action('core_upgrade_preamble');
     458    echo '</div>';
    458459    include(ABSPATH . 'wp-admin/admin-footer.php');
    459460
    460461} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
     462
     463    if ( ! current_user_can( 'update_core' ) )
     464        wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
     465
    461466    check_admin_referer('upgrade-core');
    462467
Note: See TracChangeset for help on using the changeset viewer.