Make WordPress Core

Ticket #31470: 31470.patch

File 31470.patch, 2.4 KB (added by vancoder, 10 years ago)

Check for publish_pages cap before nagging

  • wp-admin/includes/update.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    204204        if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
    205205                return false;
    206206
    207         if ( current_user_can('update_core') ) {
    208                 $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' ) );
    209         } else {
    210                 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
    211         }
    212         echo "<div class='update-nag'>$msg</div>";
    213 }
     207        if ( current_user_can( 'publish_pages' ) ) {
     208                if ( current_user_can( 'update_core' ) ) {
     209                        $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' ) );
     210                } else {
     211                        $msg = sprintf( __( '<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.' ), $cur->current );
     212                }
     213                echo "<div class='update-nag'>$msg</div>";
     214        }
     215
     216}
    214217add_action( 'admin_notices', 'update_nag', 3 );
    215218add_action( 'network_admin_notices', 'update_nag', 3 );
    216219
     
    422425        if ( ! $nag )
    423426                return false;
    424427
    425         if ( current_user_can('update_core') )
    426                 $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
    427         else
    428                 $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
     428        if ( current_user_can( 'publish_pages' ) ) {
     429                if ( current_user_can( 'update_core' ) ) {
     430                        $msg = sprintf( __( 'An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.' ), 'update-core.php' );
     431                } else {
     432                        $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
     433                }
    429434
    430         echo "<div class='update-nag'>$msg</div>";
     435                echo "<div class='update-nag'>$msg</div>";
     436        }
     437
    431438}
    432439add_action( 'admin_notices', 'maintenance_nag' );
    433440add_action( 'network_admin_notices', 'maintenance_nag' );