Make WordPress Core


Ignore:
Timestamp:
03/21/2012 04:19:27 PM (15 years ago)
Author:
nacin
Message:

Visually merge a plugin with its update notice. Same applies to themes in the network admin. Move from 'update automatically' to 'update now'. fixes #20273.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-plugins-list-table.php

    r20046 r20236  
    6666                                $plugins['dropins'] = get_dropins();
    6767
    68                         $current = get_site_transient( 'update_plugins' );
    69                         foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
    70                                 if ( isset( $current->response[ $plugin_file ] ) )
    71                                         $plugins['upgrade'][ $plugin_file ] = $plugin_data;
     68                        if ( current_user_can( 'update_plugins' ) ) {
     69                                $current = get_site_transient( 'update_plugins' );
     70                                foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
     71                                        if ( isset( $current->response[ $plugin_file ] ) ) {
     72                                                $plugins['all'][ $plugin_file ]['update'] = true;
     73                                                $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ];
     74                                        }
     75                                }
    7276                        }
    7377                }
    … …  
    101105                }
    102106
    103                 if ( !current_user_can( 'update_plugins' ) )
    104                         $plugins['upgrade'] = array();
    105 
    106107                if ( $s ) {
    107108                        $status = 'search';
    … …  
    313314
    314315        function single_row( $plugin_file, $plugin_data ) {
    315                 global $status, $page, $s;
     316                global $status, $page, $s, $totals;
    316317
    317318                $context = $status;
    … …  
    395396
    396397                $id = sanitize_title( $plugin_name );
     398                if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
     399                        $class .= ' update';
    397400
    398401                echo "<tr id='$id' class='$class'>";
Note: See TracChangeset for help on using the changeset viewer.