Make WordPress Core

Changeset 34796


Ignore:
Timestamp:
10/03/2015 07:23:20 AM (8 years ago)
Author:
DrewAPicture
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

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

    r34750 r34796  
    7575
    7676        $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
     77
     78        /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
     79        $args = apply_filters( 'users_list_table_query_args', $args, $this );
    7780
    7881        // Query the user IDs for this page
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r34707 r34796  
    107107        if ( isset( $_REQUEST['order'] ) )
    108108            $args['order'] = $_REQUEST['order'];
     109
     110        /**
     111         * Filter the query arguments used to retrieve users for the current users list table.
     112         *
     113         * @since 4.4.0
     114         *
     115         * @param array $args Arguments passed to WP_User_Query to retrieve items for the current
     116         *                    users list table.
     117         * @param mixed $this The current WP_Users_List_Table or WP_MS_Users_List_Table instance.
     118         */
     119        $args = apply_filters( 'users_list_table_query_args', $args, $this );
    109120
    110121        // Query the user IDs for this page
Note: See TracChangeset for help on using the changeset viewer.