WP_Users_List_Table
- Since
- 3.1.0
- Source
wp-admin/includes/class-wp-users-list-table.php:17
Core class used to implement displaying users in a list table.
Compatibility
- WordPress
- since 3.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 6
Every hook that fires from inside WP_Users_List_Table, in the order it appears in the class, grouped by the method that fires it.
WP_Users_List_Table::extra_tablenav()
- do_action( restrict_manage_users )action line 330
- do_action( manage_users_extra_tablenav )action line 342
WP_Users_List_Table::single_row()
- apply_filters( user_row_actions )filter line 520
- apply_filters( manage_users_custom_column )filter line 625
Properties · 2
$site_idintpublic- Site ID to generate the Users list table for.
$is_site_usersboolpublic- Whether or not the current Users list table is for Multisite.
Methods · 14
- __construct()Constructor.
- ajax_user_can()Checks the current user's permissions.
- prepare_items()Prepares the users list for display.
- no_items()Outputs 'no users' message.
- get_views()Returns an associative array listing all the views that can be used with this table.
- get_bulk_actions()Retrieves an associative array of bulk actions available on this table.
- extra_tablenav()Outputs the controls to allow user roles to be changed in bulk.
- current_action()Captures the bulk action required, and return it.
- get_columns()Gets a list of columns for the list table.
- get_sortable_columns()Gets a list of sortable columns for the list table.
- display_rows()Generates the list table rows.
- single_row()Generates HTML for a single row on the users.php admin panel.
- get_default_primary_column_name()Gets the name of the default primary column.
- get_role_list()Returns an array of translated user role names for a given user object.
Source code
class WP_Users_List_Table extends WP_List_Table { /** * Site ID to generate the Users list table for. * * @since 3.1.0 * @var int */ public $site_id; /** * Whether or not the current Users list table is for Multisite. * * @since 3.1.0 * @var bool */ public $is_site_users; /** * Constructor. * * @since 3.1.0 * * @see WP_List_Table::__construct() for more information on default arguments. * * @param array $args An associative array of arguments. */ public function __construct( $args = array() ) { parent::__construct( array( 'singular' => 'user', 'plural' => 'users', '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'] ) ? (int) $_REQUEST['id'] : 0; } } /** * Checks the current user's permissions. * * @since 3.1.0 * * @return bool */ public function ajax_user_can() { if ( $this->is_site_users ) { return current_user_can( 'manage_sites' ); } else { return current_user_can( 'list_users' ); } } /** * Prepares the users list for display. * * @since 3.1.0 * * @global string $role * @global string $usersearch */ public function prepare_items() { global $role, $usersearch; $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; $role = $_REQUEST['role'] ?? ''; $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; $users_per_page = $this->get_items_per_page( $per_page ); $paged = $this->get_pagenum(); if ( 'none' === $role ) { $args = array(Changelog
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-admin/includes/class-wp-users-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.