On the plugins page, set and at the right time. See #14579

git-svn-id: https://develop.svn.wordpress.org/trunk@15527 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu 2010-08-24 19:50:55 +00:00
parent b14febd290
commit c521615314
2 changed files with 13 additions and 11 deletions

View File

@ -3061,6 +3061,19 @@ class WP_MS_Users_Table extends WP_List_Table {
class WP_Plugins_Table extends WP_List_Table {
function WP_Plugins_Table() {
global $status, $page;
$default_status = get_user_option( 'plugins_last_view' );
if ( empty( $default_status ) )
$default_status = 'all';
$status = isset( $_REQUEST['plugin_status'] ) ? $_REQUEST['plugin_status'] : $default_status;
if ( !in_array( $status, array( 'all', 'active', 'inactive', 'recently_activated', 'upgrade', 'network', 'mustuse', 'dropins', 'search' ) ) )
$status = 'all';
if ( $status != $default_status && 'search' != $status )
update_user_meta( get_current_user_id(), 'plugins_last_view', $status );
$page = $this->get_pagenum();
parent::WP_List_Table( array(
'screen' => 'plugins',
'plural' => 'plugins',
@ -3086,8 +3099,6 @@ class WP_Plugins_Table extends WP_List_Table {
wp_reset_vars( array( 'orderby', 'order', 's' ) );
$page = $this->get_pagenum();
$plugins = array(
'all' => apply_filters( 'all_plugins', get_plugins() ),
'search' => array(),

View File

@ -293,15 +293,6 @@ if ( !empty($action) ) {
}
}
$default_status = get_user_option( 'plugins_last_view' );
if ( empty( $default_status ) )
$default_status = 'all';
$status = isset( $_REQUEST['plugin_status'] ) ? $_REQUEST['plugin_status'] : $default_status;
if ( !in_array( $status, array( 'all', 'active', 'inactive', 'recently_activated', 'upgrade', 'network', 'mustuse', 'dropins', 'search' ) ) )
$status = 'all';
if ( $status != $default_status && 'search' != $status )
update_user_meta( get_current_user_id(), 'plugins_last_view', $status );
$wp_list_table->prepare_items();
wp_enqueue_script('plugin-install');