diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index 06042da368..69b235a33b 100644
--- a/wp-admin/includes/ajax-actions.php
+++ b/wp-admin/includes/ajax-actions.php
@@ -29,17 +29,12 @@ function wp_ajax_nopriv_autosave() {
* GET-based Ajax handlers.
*/
function wp_ajax_fetch_list() {
- global $current_screen, $wp_list_table;
+ global $wp_list_table;
$list_class = $_GET['list_args']['class'];
check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' );
- $current_screen = convert_to_screen( $_GET['list_args']['screen']['id'] );
-
- define( 'WP_NETWORK_ADMIN', $current_screen->is_network );
- define( 'WP_USER_ADMIN', $current_screen->is_user );
-
- $wp_list_table = _get_list_table( $list_class );
+ $wp_list_table = _get_list_table( $list_class, array( 'screen' => $_GET['list_args']['screen']['id'] ) );
if ( ! $wp_list_table )
wp_die( 0 );
@@ -615,9 +610,7 @@ function wp_ajax_add_tag() {
$x->send();
}
- set_current_screen( $_POST['screen'] );
-
- $wp_list_table = _get_list_table('WP_Terms_List_Table');
+ $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) );
$level = 0;
if ( is_taxonomy_hierarchical($taxonomy) ) {
@@ -686,9 +679,7 @@ function wp_ajax_get_comments( $action ) {
check_ajax_referer( $action );
- set_current_screen( 'edit-comments' );
-
- $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
+ $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
if ( !current_user_can( 'edit_post', $post_id ) )
wp_die( -1 );
@@ -723,8 +714,6 @@ function wp_ajax_replyto_comment( $action ) {
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
- set_current_screen( 'edit-comments' );
-
$comment_post_ID = (int) $_POST['comment_post_ID'];
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
wp_die( -1 );
@@ -782,9 +771,9 @@ function wp_ajax_replyto_comment( $action ) {
_wp_dashboard_recent_comments_row( $comment );
} else {
if ( 'single' == $_REQUEST['mode'] ) {
- $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
+ $wp_list_table = _get_list_table('WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
} else {
- $wp_list_table = _get_list_table('WP_Comments_List_Table');
+ $wp_list_table = _get_list_table('WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
}
$wp_list_table->single_row( $comment );
}
@@ -811,8 +800,6 @@ function wp_ajax_edit_comment() {
check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
- set_current_screen( 'edit-comments' );
-
$comment_id = (int) $_POST['comment_ID'];
if ( ! current_user_can( 'edit_comment', $comment_id ) )
wp_die( -1 );
@@ -827,7 +814,7 @@ function wp_ajax_edit_comment() {
$comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
- $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table' );
+ $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
$comment = get_comment( $comment_id );
@@ -1330,8 +1317,6 @@ function wp_ajax_inline_save() {
wp_die( __( 'You are not allowed to edit this post.' ) );
}
- set_current_screen( $_POST['screen'] );
-
if ( $last = wp_check_post_lock( $post_ID ) ) {
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
@@ -1367,7 +1352,7 @@ function wp_ajax_inline_save() {
// update the post
edit_post();
- $wp_list_table = _get_list_table('WP_Posts_List_Table');
+ $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
$mode = $_POST['post_view'];
@@ -1399,9 +1384,7 @@ function wp_ajax_inline_save_tax() {
if ( ! current_user_can( $tax->cap->edit_terms ) )
wp_die( -1 );
- set_current_screen( 'edit-' . $taxonomy );
-
- $wp_list_table = _get_list_table('WP_Terms_List_Table');
+ $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );
if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
wp_die( -1 );
diff --git a/wp-admin/includes/class-wp-links-list-table.php b/wp-admin/includes/class-wp-links-list-table.php
index 34be076aaf..2a897b76ba 100644
--- a/wp-admin/includes/class-wp-links-list-table.php
+++ b/wp-admin/includes/class-wp-links-list-table.php
@@ -9,9 +9,10 @@
*/
class WP_Links_List_Table extends WP_List_Table {
- function __construct() {
+ function __construct( $args = array() ) {
parent::__construct( array(
'plural' => 'bookmarks',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
) );
}
diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php
index 60a8a608f7..97489cdb86 100644
--- a/wp-admin/includes/class-wp-list-table.php
+++ b/wp-admin/includes/class-wp-list-table.php
@@ -81,15 +81,16 @@ class WP_List_Table {
$args = wp_parse_args( $args, array(
'plural' => '',
'singular' => '',
- 'ajax' => false
+ 'ajax' => false,
+ 'screen' => null,
) );
- $screen = get_current_screen();
+ $this->screen = convert_to_screen( $args['screen'] );
- add_filter( "manage_{$screen->id}_columns", array( &$this, 'get_columns' ), 0 );
+ add_filter( "manage_{$this->screen->id}_columns", array( &$this, 'get_columns' ), 0 );
if ( !$args['plural'] )
- $args['plural'] = $screen->base;
+ $args['plural'] = $this->screen->base;
$args['plural'] = sanitize_key( $args['plural'] );
$args['singular'] = sanitize_key( $args['singular'] );
@@ -242,10 +243,8 @@ class WP_List_Table {
* @access public
*/
function views() {
- $screen = get_current_screen();
-
$views = $this->get_views();
- $views = apply_filters( 'views_' . $screen->id, $views );
+ $views = apply_filters( 'views_' . $this->screen->id, $views );
if ( empty( $views ) )
return;
@@ -278,12 +277,10 @@ class WP_List_Table {
* @access public
*/
function bulk_actions() {
- $screen = get_current_screen();
-
if ( is_null( $this->_actions ) ) {
$no_new_actions = $this->_actions = $this->get_bulk_actions();
// This filter can currently only be used to remove actions.
- $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions );
+ $this->_actions = apply_filters( 'bulk_actions-' . $this->screen->id, $this->_actions );
$this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
$two = '';
} else {
@@ -604,12 +601,10 @@ class WP_List_Table {
if ( isset( $this->_column_headers ) )
return $this->_column_headers;
- $screen = get_current_screen();
+ $columns = get_column_headers( $this->screen );
+ $hidden = get_hidden_columns( $this->screen );
- $columns = get_column_headers( $screen );
- $hidden = get_hidden_columns( $screen );
-
- $_sortable = apply_filters( "manage_{$screen->id}_sortable_columns", $this->get_sortable_columns() );
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $this->get_sortable_columns() );
$sortable = array();
foreach ( $_sortable as $id => $data ) {
@@ -651,8 +646,6 @@ class WP_List_Table {
* @param bool $with_id Whether to set the id attribute or not
*/
function print_column_headers( $with_id = true ) {
- $screen = get_current_screen();
-
list( $columns, $hidden, $sortable ) = $this->get_column_info();
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
@@ -914,13 +907,11 @@ class WP_List_Table {
* @access private
*/
function _js_vars() {
- $current_screen = get_current_screen();
-
$args = array(
'class' => get_class( $this ),
'screen' => array(
- 'id' => $current_screen->id,
- 'base' => $current_screen->base,
+ 'id' => $this->screen->id,
+ 'base' => $this->screen->base,
)
);
diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php
index 77fdda040b..b4126f5ee9 100644
--- a/wp-admin/includes/class-wp-media-list-table.php
+++ b/wp-admin/includes/class-wp-media-list-table.php
@@ -9,11 +9,12 @@
*/
class WP_Media_List_Table extends WP_List_Table {
- function __construct() {
+ function __construct( $args = array() ) {
$this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] );
parent::__construct( array(
- 'plural' => 'media'
+ 'plural' => 'media',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
) );
}
diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php
index 1bdc758573..a3e403dc3d 100644
--- a/wp-admin/includes/class-wp-ms-sites-list-table.php
+++ b/wp-admin/includes/class-wp-ms-sites-list-table.php
@@ -9,9 +9,10 @@
*/
class WP_MS_Sites_List_Table extends WP_List_Table {
- function __construct() {
+ function __construct( $args = array() ) {
parent::__construct( array(
'plural' => 'sites',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
) );
}
diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php
index 65e9515cc1..4c83b310df 100644
--- a/wp-admin/includes/class-wp-ms-themes-list-table.php
+++ b/wp-admin/includes/class-wp-ms-themes-list-table.php
@@ -12,24 +12,24 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
var $site_id;
var $is_site_themes;
- function __construct() {
+ function __construct( $args = array() ) {
global $status, $page;
+ parent::__construct( array(
+ 'plural' => 'themes',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+ ) );
+
$status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) )
$status = 'all';
$page = $this->get_pagenum();
- $screen = get_current_screen();
- $this->is_site_themes = ( 'site-themes-network' == $screen->id ) ? true : false;
+ $this->is_site_themes = ( 'site-themes-network' == $this->screen->id ) ? true : false;
if ( $this->is_site_themes )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
-
- parent::__construct( array(
- 'plural' => 'themes'
- ) );
}
function get_table_classes() {
diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php
index df569f109b..aed80b579c 100644
--- a/wp-admin/includes/class-wp-plugins-list-table.php
+++ b/wp-admin/includes/class-wp-plugins-list-table.php
@@ -9,9 +9,14 @@
*/
class WP_Plugins_List_Table extends WP_List_Table {
- function __construct() {
+ function __construct( $args = array() ) {
global $status, $page;
+ parent::__construct( array(
+ 'plural' => 'plugins',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+ ) );
+
$status = 'all';
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) )
$status = $_REQUEST['plugin_status'];
@@ -20,10 +25,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
$_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']) );
$page = $this->get_pagenum();
-
- parent::__construct( array(
- 'plural' => 'plugins',
- ) );
}
function get_table_classes() {
@@ -50,7 +51,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
'dropins' => array()
);
- $screen = get_current_screen();
+ $screen = $this->screen;
if ( ! is_multisite() || ( $screen->is_network && current_user_can('manage_network_plugins') ) ) {
if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
@@ -91,7 +92,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|| ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) {
$plugins['active'][ $plugin_file ] = $plugin_data;
} else {
- if ( !$screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
+ if ( ! $screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
$plugins['recently_activated'][ $plugin_file ] = $plugin_data;
$plugins['inactive'][ $plugin_file ] = $plugin_data;
}
@@ -236,15 +237,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
$actions = array();
- $screen = get_current_screen();
-
if ( 'active' != $status )
- $actions['activate-selected'] = $screen->is_network ? __( 'Network Activate' ) : __( 'Activate' );
+ $actions['activate-selected'] = $this->screen->is_network ? __( 'Network Activate' ) : __( 'Activate' );
if ( 'inactive' != $status && 'recent' != $status )
- $actions['deactivate-selected'] = $screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' );
+ $actions['deactivate-selected'] = $this->screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' );
- if ( !is_multisite() || $screen->is_network ) {
+ if ( !is_multisite() || $this->screen->is_network ) {
if ( current_user_can( 'update_plugins' ) )
$actions['update-selected'] = __( 'Update' );
if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
@@ -271,9 +270,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
echo '
';
- $screen = get_current_screen();
-
- if ( ! $screen->is_network && 'recently_activated' == $status )
+ if ( ! $this->screen->is_network && 'recently_activated' == $status )
submit_button( __( 'Clear List' ), 'small', 'clear-recent-list', false );
elseif ( 'top' == $which && 'mustuse' == $status )
echo '
' . sprintf( __( 'Files in the %s directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '
';
@@ -293,9 +290,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
function display_rows() {
global $status;
- $screen = get_current_screen();
-
- if ( is_multisite() && !$screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) )
+ if ( is_multisite() && ! $this->screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) )
return;
foreach ( $this->items as $plugin_file => $plugin_data )
@@ -306,8 +301,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
global $status, $page, $s, $totals;
$context = $status;
-
- $screen = get_current_screen();
+ $screen = $this->screen;
// preorder
$actions = array(
diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
index c9126ef7ce..aea8f7a54b 100644
--- a/wp-admin/includes/class-wp-posts-list-table.php
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -45,10 +45,15 @@ class WP_Posts_List_Table extends WP_List_Table {
*/
var $sticky_posts_count = 0;
- function __construct() {
+ function __construct( $args = array() ) {
global $post_type_object, $wpdb;
- $post_type = get_current_screen()->post_type;
+ parent::__construct( array(
+ 'plural' => 'posts',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+ ) );
+
+ $post_type = $this->screen->post_type;
$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
@@ -66,28 +71,22 @@ class WP_Posts_List_Table extends WP_List_Table {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
}
-
- parent::__construct( array(
- 'plural' => 'posts',
- ) );
}
function ajax_user_can() {
- global $post_type_object;
-
- return current_user_can( $post_type_object->cap->edit_posts );
+ return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
}
function prepare_items() {
- global $post_type_object, $avail_post_stati, $wp_query, $per_page, $mode;
+ global $avail_post_stati, $wp_query, $per_page, $mode;
$avail_post_stati = wp_edit_posts_query();
- $this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] );
+ $this->hierarchical_display = ( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] );
$total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
- $post_type = $post_type_object->name;
+ $post_type = $this->screen->post_type;
$per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
$per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
@@ -112,18 +111,16 @@ class WP_Posts_List_Table extends WP_List_Table {
}
function no_items() {
- global $post_type_object;
-
if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
- echo $post_type_object->labels->not_found_in_trash;
+ echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
else
- echo $post_type_object->labels->not_found;
+ echo get_post_type_object( $this->screen->post_type )->labels->not_found;
}
function get_views() {
- global $post_type_object, $locked_post_status, $avail_post_stati;
+ global $locked_post_status, $avail_post_stati;
- $post_type = $post_type_object->name;
+ $post_type = $this->screen->post_type;
if ( !empty($locked_post_status) )
return array();
@@ -198,15 +195,15 @@ class WP_Posts_List_Table extends WP_List_Table {
}
function extra_tablenav( $which ) {
- global $post_type_object, $cat;
+ global $cat;
?>
months_dropdown( $post_type_object->name );
+ $this->months_dropdown( $this->screen->post_type );
- if ( is_object_in_taxonomy( $post_type_object->name, 'category' ) ) {
+ if ( is_object_in_taxonomy( $this->screen->post_type, 'category' ) ) {
$dropdown_options = array(
'show_option_all' => __( 'View all categories' ),
'hide_empty' => 0,
@@ -221,7 +218,7 @@ class WP_Posts_List_Table extends WP_List_Table {
submit_button( __( 'Filter' ), 'small', false, false, array( 'id' => 'post-query-submit' ) );
}
- if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+ if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
submit_button( __( 'Empty Trash' ), 'small apply', 'delete_all', false );
}
?>
@@ -237,27 +234,20 @@ class WP_Posts_List_Table extends WP_List_Table {
}
function pagination( $which ) {
- global $post_type_object, $mode;
+ global $mode;
parent::pagination( $which );
- if ( 'top' == $which && !$post_type_object->hierarchical )
+ if ( 'top' == $which && ! is_post_type_hierarchical( $this->screen->post_type ) )
$this->view_switcher( $mode );
}
function get_table_classes() {
- global $post_type_object;
-
- return array( 'widefat', 'fixed', $post_type_object->hierarchical ? 'pages' : 'posts' );
+ return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
}
function get_columns() {
- $screen = get_current_screen();
-
- if ( empty( $screen ) )
- $post_type = 'post';
- else
- $post_type = $screen->post_type;
+ $post_type = $this->screen->post_type;
$posts_columns = array();
@@ -313,7 +303,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
function display_rows( $posts = array(), $level = 0 ) {
- global $wp_query, $post_type_object, $per_page;
+ global $wp_query, $per_page;
if ( empty( $posts ) )
$posts = $wp_query->posts;
@@ -701,7 +691,7 @@ class WP_Posts_List_Table extends WP_List_Table {
function inline_edit() {
global $mode;
- $screen = get_current_screen();
+ $screen = $this->screen;
$post = get_default_post_to_edit( $screen->post_type );
$post_type_object = get_post_type_object( $screen->post_type );
@@ -733,8 +723,8 @@ class WP_Posts_List_Table extends WP_List_Table {
$bulk = 0;
while ( $bulk < 2 ) { ?>
-
post_type ";
- echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";
+
post_type;
+ echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}" : "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
?>" style="display: none">|
|
diff --git a/wp-admin/includes/class-wp-themes-list-table.php b/wp-admin/includes/class-wp-themes-list-table.php
index 5bfed52714..7a89fc889b 100644
--- a/wp-admin/includes/class-wp-themes-list-table.php
+++ b/wp-admin/includes/class-wp-themes-list-table.php
@@ -12,9 +12,10 @@ class WP_Themes_List_Table extends WP_List_Table {
protected $search_terms = array();
var $features = array();
- function __construct() {
+ function __construct( $args = array() ) {
parent::__construct( array(
'ajax' => true,
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
) );
}
diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php
index 4ebef6644a..7039721418 100644
--- a/wp-admin/includes/class-wp-users-list-table.php
+++ b/wp-admin/includes/class-wp-users-list-table.php
@@ -12,17 +12,17 @@ class WP_Users_List_Table extends WP_List_Table {
var $site_id;
var $is_site_users;
- function __construct() {
- $screen = get_current_screen();
- $this->is_site_users = 'site-users-network' == $screen->id;
+ function __construct( $args = array() ) {
+ parent::__construct( array(
+ 'singular' => 'user',
+ 'plural' => 'users',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+ ) );
+
+ $this->is_site_users = 'site-users-network' == $this->screen->id;
if ( $this->is_site_users )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
-
- parent::__construct( array(
- 'singular' => 'user',
- 'plural' => 'users'
- ) );
}
function ajax_user_can() {
diff --git a/wp-admin/includes/list-table.php b/wp-admin/includes/list-table.php
index 2dff578e0d..bccf0cab33 100644
--- a/wp-admin/includes/list-table.php
+++ b/wp-admin/includes/list-table.php
@@ -14,9 +14,10 @@
* @since 3.1.0
*
* @param string $class The type of the list table, which is the class name.
+ * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'.
* @return object|bool Object on success, false if the class does not exist.
*/
-function _get_list_table( $class ) {
+function _get_list_table( $class, $args = array() ) {
$core_classes = array(
//Site Admin
'WP_Posts_List_Table' => 'posts',
@@ -39,7 +40,13 @@ function _get_list_table( $class ) {
if ( isset( $core_classes[ $class ] ) ) {
foreach ( (array) $core_classes[ $class ] as $required )
require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' );
- return new $class;
+
+ if ( isset( $args['screen'] ) )
+ $args['screen'] = convert_to_screen( $args['screen'] );
+ else
+ $args['screen'] = get_current_screen();
+
+ return new $class( $args );
}
return false;