From 44e34f826b50f3ceec4acb6be5fd46e97bd56085 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 28 Feb 2014 20:22:14 +0000 Subject: [PATCH] Don't filter out network-only plugins from the Plugins screen if they're individually active on the current site. Add some code comments for clarity. Props mordauk Built from https://develop.svn.wordpress.org/trunk@27326 git-svn-id: http://core.svn.wordpress.org/trunk@27178 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-plugins-list-table.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index 9e648498fe..00e0ec2ffc 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -83,16 +83,23 @@ class WP_Plugins_List_Table extends WP_List_Table { foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { // Filter into individual sections - if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) ) { + if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { + // On the non-network screen, filter out network-only plugins as long as they're not individually activated unset( $plugins['all'][ $plugin_file ] ); } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { + // On the non-network screen, filter out network activated plugins unset( $plugins['all'][ $plugin_file ] ); } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { + // On the non-network screen, populate the active list with plugins that are individually activated + // On the network-admin screen, populate the active list with plugins that are network activated $plugins['active'][ $plugin_file ] = $plugin_data; } else { - if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated? + if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) { + // On the non-network screen, populate the recently activated list with plugins that have been recently activated $plugins['recently_activated'][ $plugin_file ] = $plugin_data; + } + // Populate the inactive list with plugins that aren't activated $plugins['inactive'][ $plugin_file ] = $plugin_data; } }