Users: Introduce the users_list_table_query_args filter, for modifying the WP_User_Query arguments used within the prepare_items() methods in the users list tables.

The current list table is passed as a second parameter, `$this`, and can take the form of either a `WP_Users_List_Table` or `WP_MS_Users_List_Table` instance depending on the context in which the filter was evaluated.

Props juliobox for the initial patch.
Fixes #25360.

Built from https://develop.svn.wordpress.org/trunk@34796


git-svn-id: http://core.svn.wordpress.org/trunk@34761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2015-10-03 07:24:25 +00:00
parent f6b2797bd3
commit b38569a5fc
3 changed files with 15 additions and 1 deletions

View File

@ -75,6 +75,9 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
$args = apply_filters( 'users_list_table_query_args', $args, $this );
// Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args );

View File

@ -107,6 +107,17 @@ class WP_Users_List_Table extends WP_List_Table {
if ( isset( $_REQUEST['order'] ) )
$args['order'] = $_REQUEST['order'];
/**
* Filter the query arguments used to retrieve users for the current users list table.
*
* @since 4.4.0
*
* @param array $args Arguments passed to WP_User_Query to retrieve items for the current
* users list table.
* @param mixed $this The current WP_Users_List_Table or WP_MS_Users_List_Table instance.
*/
$args = apply_filters( 'users_list_table_query_args', $args, $this );
// Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34795';
$wp_version = '4.4-alpha-34796';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.