if ( $wp_list_table->current_action() && ! empty( $_REQUEST['users'] ) ) {
$screen = get_current_screen()->id;
$sendback = wp_get_referer();
$userids = $_REQUEST['users'];
/** This action is documented in wp-admin/edit.php */
$sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $wp_list_table->current_action(), $userids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
wp_safe_redirect( $sendback );
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
if ( $pagenum > $total_pages && $total_pages > 0 ) {
wp_redirect( add_query_arg( 'paged', $total_pages ) );
require_once ABSPATH . 'wp-admin/admin-header.php';
if ( isset( $_GET['update'] ) ) :
switch ( $_GET['update'] ) {
$delete_count = isset( $_GET['delete_count'] ) ? (int) $_GET['delete_count'] : 0;
if ( 1 == $delete_count ) {
$message = __( 'User deleted.' );
/* translators: %s: Number of users. */
$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
$message = __( 'New user created.' );
$user_id = isset( $_GET['id'] ) ? $_GET['id'] : false;
if ( $user_id && current_user_can( 'edit_user', $user_id ) ) {
urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
self_admin_url( 'user-edit.php?user_id=' . $user_id )
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>';
$reset_count = isset( $_GET['reset_count'] ) ? (int) $_GET['reset_count'] : 0;
if ( 1 === $reset_count ) {
$message = __( 'Password reset link sent.' );
/* translators: %s: Number of users. */
$message = _n( 'Password reset links sent to %s user.', 'Password reset links sent to %s users.', $reset_count );
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $reset_count ) ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'The current user’s role must have user editing capabilities.' ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Other user roles have been changed.' ) . '</p></div>';
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'You can’t delete the current user.' ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Other users have been deleted.' ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'User removed from this site.' ) . '</p></div>';
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( "You can't remove the current user." ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'Other users have been removed.' ) . '</p></div>';
<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
foreach ( $errors->get_error_messages() as $err ) {
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg ) {
<h1 class="wp-heading-inline">
if ( current_user_can( 'create_users' ) ) {
<a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
<a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
if ( strlen( $usersearch ) ) {
echo '<span class="subtitle">';
/* translators: %s: Search query. */
__( 'Search results for: %s' ),
'<strong>' . esc_html( $usersearch ) . '</strong>'
<hr class="wp-header-end">
<?php $wp_list_table->views(); ?>
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
<?php if ( ! empty( $_REQUEST['role'] ) ) { ?>
<input type="hidden" name="role" value="<?php echo esc_attr( $_REQUEST['role'] ); ?>" />
<?php $wp_list_table->display(); ?>
<div class="clear" /></div>
} // End of the $doaction switch.
require_once ABSPATH . 'wp-admin/admin-footer.php';