Make WordPress Core


Ignore:
Timestamp:
09/25/2015 07:15:08 PM (10 years ago)
Author:
johnbillion
Message:

Implement 'Recently Active' functionality for network-wide plugins in the Network Admin.

Fixes #20468
Thanks to WordCamp RI attendees for testing!

File:
1 edited

Legend:

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

    r34383 r34551  
    130130        set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
    131131
    132         if ( ! $screen->in_admin( 'network' ) ) {
     132        if ( $screen->in_admin( 'network' ) ) {
     133            $recently_activated = get_site_option( 'recently_activated', array() );
     134        } else {
    133135            $recently_activated = get_option( 'recently_activated', array() );
    134 
    135             foreach ( $recently_activated as $key => $time )
    136                 if ( $time + WEEK_IN_SECONDS < time() )
    137                     unset( $recently_activated[$key] );
     136        }
     137
     138        foreach ( $recently_activated as $key => $time ) {
     139            if ( $time + WEEK_IN_SECONDS < time() ) {
     140                unset( $recently_activated[$key] );
     141            }
     142        }
     143
     144        if ( $screen->in_admin( 'network' ) ) {
     145            update_site_option( 'recently_activated', $recently_activated );
     146        } else {
    138147            update_option( 'recently_activated', $recently_activated );
    139148        }
     
    171180                $plugins['active'][ $plugin_file ] = $plugin_data;
    172181            } else {
    173                 if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) {
    174                     // On the non-network screen, populate the recently activated list with plugins that have been recently activated
     182                if ( isset( $recently_activated[ $plugin_file ] ) ) {
     183                    // Populate the recently activated list with plugins that have been recently activated
    175184                    $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
    176185                }
     
    401410        echo '<div class="alignleft actions">';
    402411
    403         if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' === $status ) {
     412        if ( 'recently_activated' == $status ) {
    404413            submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
    405414        } elseif ( 'top' === $which && 'mustuse' === $status ) {
Note: See TracChangeset for help on using the changeset viewer.