1<?php 2/** 3 * User administration panel 4 * 5 * @package WordPress 6 * @subpackage Administration 7 * @since 1.0.0 8 */ 9 10/** WordPress Administration Bootstrap */ 11require_once __DIR__ . '/admin.php'; 12 13if ( ! current_user_can( 'list_users' ) ) { 14 wp_die( 15 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 16 '<p>' . __( 'Sorry, you are not allowed to list users.' ) . '</p>', 17 403 18 ); 19} 20 21$wp_list_table = _get_list_table( 'WP_Users_List_Table' ); 22$pagenum = $wp_list_table->get_pagenum(); 23$title = __( 'Users' ); 24$parent_file = 'users.php'; 25 26add_screen_option( 'per_page' ); 27 28// Contextual help - choose Help on the top right of admin panel to preview this. 29get_current_screen()->add_help_tab( 30 array( 31 'id' => 'overview', 32 'title' => __( 'Overview' ), 33 'content' => '<p>' . __( 'This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.' ) . '</p>' . 34 '<p>' . __( 'To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.' ) . '</p>', 35 ) 36); 37 38get_current_screen()->add_help_tab( 39 array( 40 'id' => 'screen-content', 41 'title' => __( 'Screen Content' ), 42 'content' => '<p>' . __( 'You can customize the display of this screen in a number of ways:' ) . '</p>' . 43 '<ul>' . 44 '<li>' . __( 'You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.' ) . '</li>' . 45 '<li>' . __( 'You can filter the list of users by User Role using the text links above the users list to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.' ) . '</li>' . 46 '<li>' . __( 'You can view all posts made by a user by clicking on the number under the Posts column.' ) . '</li>' . 47 '</ul>', 48 ) 49); 50 51$help = '<p>' . __( 'Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:' ) . '</p>' . 52 '<ul>' . 53 '<li>' . __( '<strong>Edit</strong> takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.' ) . '</li>'; 54 55if ( is_multisite() ) { 56 $help .= '<li>' . __( '<strong>Remove</strong> allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using bulk actions.' ) . '</li>'; 57} else { 58 $help .= '<li>' . __( '<strong>Delete</strong> brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using bulk actions.' ) . '</li>'; 59} 60 61$help .= '</ul>'; 62 63get_current_screen()->add_help_tab( 64 array( 65 'id' => 'action-links', 66 'title' => __( 'Available Actions' ), 67 'content' => $help, 68 ) 69); 70unset( $help ); 71 72get_current_screen()->set_help_sidebar( 73 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 74 '<p>' . __( '<a href="https://wordpress.org/support/article/users-screen/">Documentation on Managing Users</a>' ) . '</p>' . 75 '<p>' . __( '<a href="https://wordpress.org/support/article/roles-and-capabilities/">Descriptions of Roles and Capabilities</a>' ) . '</p>' . 76 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 77); 78 79get_current_screen()->set_screen_reader_content( 80 array( 81 'heading_views' => __( 'Filter users list' ), 82 'heading_pagination' => __( 'Users list navigation' ), 83 'heading_list' => __( 'Users list' ), 84 ) 85); 86 87if ( empty( $_REQUEST ) ) { 88 $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />'; 89} elseif ( isset( $_REQUEST['wp_http_referer'] ) ) { 90 $redirect = remove_query_arg( array( 'wp_http_referer', 'updated', 'delete_count' ), wp_unslash( $_REQUEST['wp_http_referer'] ) ); 91 $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr( $redirect ) . '" />'; 92} else { 93 $redirect = 'users.php'; 94 $referer = ''; 95} 96 97$update = ''; 98 99switch ( $wp_list_table->current_action() ) { 100 101 /* Bulk Dropdown menu Role changes */ 102 case 'promote': 103 check_admin_referer( 'bulk-users' ); 104 105 if ( ! current_user_can( 'promote_users' ) ) { 106 wp_die( __( 'Sorry, you are not allowed to edit this user.' ), 403 ); 107 } 108 109 if ( empty( $_REQUEST['users'] ) ) { 110 wp_redirect( $redirect ); 111 exit; 112 } 113 114 $editable_roles = get_editable_roles(); 115 $role = $_REQUEST['new_role']; 116 117 // Mocking the `none` role so we are able to save it to the database 118 $editable_roles['none'] = array( 119 'name' => __( '— No role for this site —' ), 120 ); 121 122 if ( ! $role || empty( $editable_roles[ $role ] ) ) { 123 wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); 124 } 125 126 if ( 'none' === $role ) { 127 $role = ''; 128 } 129 130 $userids = $_REQUEST['users']; 131 $update = 'promote'; 132 foreach ( $userids as $id ) { 133 $id = (int) $id; 134 135 if ( ! current_user_can( 'promote_user', $id ) ) { 136 wp_die( __( 'Sorry, you are not allowed to edit this user.' ), 403 ); 137 } 138 139 // The new role of the current user must also have the promote_users cap or be a multisite super admin. 140 if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap( 'promote_users' ) 141 && ! ( is_multisite() && current_user_can( 'manage_network_users' ) ) ) { 142 $update = 'err_admin_role'; 143 continue; 144 } 145 146 // If the user doesn't already belong to the blog, bail. 147 if ( is_multisite() && ! is_user_member_of_blog( $id ) ) { 148 wp_die( 149 '<h1>' . __( 'Something went wrong.' ) . '</h1>' . 150 '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>', 151 403 152 ); 153 } 154 155 $user = get_userdata( $id ); 156 $user->set_role( $role ); 157 } 158 159 wp_redirect( add_query_arg( 'update', $update, $redirect ) ); 160 exit; 161 162 case 'dodelete': 163 if ( is_multisite() ) { 164 wp_die( __( 'User deletion is not allowed from this screen.' ), 400 ); 165 } 166 167 check_admin_referer( 'delete-users' ); 168 169 if ( empty( $_REQUEST['users'] ) ) { 170 wp_redirect( $redirect ); 171 exit; 172 } 173 174 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); 175 176 if ( empty( $_REQUEST['delete_option'] ) ) { 177 $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' ); 178 $url = str_replace( '&', '&', wp_nonce_url( $url, 'bulk-users' ) ); 179 wp_redirect( $url ); 180 exit; 181 } 182 183 if ( ! current_user_can( 'delete_users' ) ) { 184 wp_die( __( 'Sorry, you are not allowed to delete users.' ), 403 ); 185 } 186 187 $update = 'del'; 188 $delete_count = 0; 189 190 foreach ( $userids as $id ) { 191 if ( ! current_user_can( 'delete_user', $id ) ) { 192 wp_die( __( 'Sorry, you are not allowed to delete that user.' ), 403 ); 193 } 194 195 if ( $id == $current_user->ID ) { 196 $update = 'err_admin_del'; 197 continue; 198 } 199 switch ( $_REQUEST['delete_option'] ) { 200 case 'delete': 201 wp_delete_user( $id ); 202 break; 203 case 'reassign': 204 wp_delete_user( $id, $_REQUEST['reassign_user'] ); 205 break; 206 } 207 ++$delete_count; 208 } 209 210 $redirect = add_query_arg( 211 array( 212 'delete_count' => $delete_count, 213 'update' => $update, 214 ), 215 $redirect 216 ); 217 wp_redirect( $redirect ); 218 exit; 219 220 case 'resetpassword': 221 check_admin_referer( 'bulk-users' ); 222 if ( ! current_user_can( 'edit_users' ) ) { 223 $errors = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to edit users.' ) ); 224 } 225 if ( empty( $_REQUEST['users'] ) ) { 226 wp_redirect( $redirect ); 227 exit(); 228 } 229 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); 230 231 $reset_count = 0; 232 233 foreach ( $userids as $id ) { 234 if ( ! current_user_can( 'edit_user', $id ) ) { 235 wp_die( __( 'Sorry, you are not allowed to edit this user.' ) ); 236 } 237 238 if ( $id === $current_user->ID ) { 239 $update = 'err_admin_reset'; 240 continue; 241 } 242 243 // Send the password reset link. 244 $user = get_userdata( $id ); 245 if ( retrieve_password( $user->user_login ) ) { 246 ++$reset_count; 247 } 248 } 249 250 $redirect = add_query_arg( 251 array( 252 'reset_count' => $reset_count, 253 'update' => 'resetpassword', 254 ), 255 $redirect 256 ); 257 wp_redirect( $redirect ); 258 exit; 259 260 case 'delete': 261 if ( is_multisite() ) { 262 wp_die( __( 'User deletion is not allowed from this screen.' ), 400 ); 263 } 264 265 check_admin_referer( 'bulk-users' ); 266 267 if ( empty( $_REQUEST['users'] ) && empty( $_REQUEST['user'] ) ) { 268 wp_redirect( $redirect ); 269 exit; 270 } 271 272 if ( ! current_user_can( 'delete_users' ) ) { 273 $errors = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to delete users.' ) ); 274 } 275 276 if ( empty( $_REQUEST['users'] ) ) { 277 $userids = array( (int) $_REQUEST['user'] ); 278 } else { 279 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); 280 } 281 282 $all_userids = $userids; 283 284 if ( in_array( $current_user->ID, $userids, true ) ) { 285 $userids = array_diff( $userids, array( $current_user->ID ) ); 286 } 287 288 /** 289 * Filters whether the users being deleted have additional content 290 * associated with them outside of the `post_author` and `link_owner` relationships. 291 * 292 * @since 5.2.0 293 * 294 * @param bool $users_have_additional_content Whether the users have additional content. Default false. 295 * @param int[] $userids Array of IDs for users being deleted. 296 */ 297 $users_have_content = (bool) apply_filters( 'users_have_additional_content', false, $userids ); 298 299 if ( $userids && ! $users_have_content ) { 300 if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . ' ) LIMIT 1' ) ) { 301 $users_have_content = true; 302 } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . ' ) LIMIT 1' ) ) { 303 $users_have_content = true; 304 } 305 } 306 307 if ( $users_have_content ) { 308 add_action( 'admin_head', 'delete_users_add_js' ); 309 } 310 311 require_once ABSPATH . 'wp-admin/admin-header.php'; 312 ?> 313 <form method="post" name="updateusers" id="updateusers"> 314 <?php wp_nonce_field( 'delete-users' ); ?> 315 <?php echo $referer; ?> 316 317<div class="wrap"> 318<h1><?php _e( 'Delete Users' ); ?></h1> 319 <?php if ( isset( $_REQUEST['error'] ) ) : ?> 320 <div class="error"> 321 <p><strong><?php _e( 'Error:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p> 322 </div> 323 <?php endif; ?> 324 325 <?php if ( 1 === count( $all_userids ) ) : ?> 326 <p><?php _e( 'You have specified this user for deletion:' ); ?></p> 327 <?php else : ?> 328 <p><?php _e( 'You have specified these users for deletion:' ); ?></p> 329 <?php endif; ?> 330 331<ul> 332 <?php 333 $go_delete = 0; 334 foreach ( $all_userids as $id ) { 335 $user = get_userdata( $id ); 336 if ( $id == $current_user->ID ) { 337 /* translators: 1: User ID, 2: User login. */ 338 echo '<li>' . sprintf( __( 'ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>' ), $id, $user->user_login ) . "</li>\n"; 339 } else { 340 /* translators: 1: User ID, 2: User login. */ 341 echo '<li><input type="hidden" name="users[]" value="' . esc_attr( $id ) . '" />' . sprintf( __( 'ID #%1$s: %2$s' ), $id, $user->user_login ) . "</li>\n"; 342 $go_delete++; 343 } 344 } 345 ?> 346 </ul> 347 <?php 348 if ( $go_delete ) : 349 350 if ( ! $users_have_content ) : 351 ?> 352 <input type="hidden" name="delete_option" value="delete" /> 353 <?php else : ?> 354 <?php if ( 1 == $go_delete ) : ?> 355 <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p> 356 <?php else : ?> 357 <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p> 358 <?php endif; ?> 359 <ul style="list-style:none;"> 360 <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" /> 361 <?php _e( 'Delete all content.' ); ?></label></li> 362 <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" /> 363 <?php 364 echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> '; 365 wp_dropdown_users( 366 array( 367 'name' => 'reassign_user', 368 'exclude' => $userids, 369 'show' => 'display_name_with_login', 370 ) 371 ); 372 ?> 373 </li> 374 </ul></fieldset> 375 <?php 376 endif; 377 /** 378 * Fires at the end of the delete users form prior to the confirm button. 379 * 380 * @since 4.0.0 381 * @since 4.5.0 The `$userids` parameter was added. 382 * 383 * @param WP_User $current_user WP_User object for the current user. 384 * @param int[] $userids Array of IDs for users being deleted. 385 */ 386 do_action( 'delete_user_form', $current_user, $userids ); 387 ?> 388 <input type="hidden" name="action" value="dodelete" /> 389 <?php submit_button( __( 'Confirm Deletion' ), 'primary' ); ?> 390 <?php else : ?> 391 <p><?php _e( 'There are no valid users selected for deletion.' ); ?></p> 392 <?php endif; ?> 393 </div> 394 </form> 395 <?php 396 397 break; 398 399 case 'doremove': 400 check_admin_referer( 'remove-users' ); 401 402 if ( ! is_multisite() ) { 403 wp_die( __( 'You can’t remove users.' ), 400 ); 404 } 405 406 if ( empty( $_REQUEST['users'] ) ) { 407 wp_redirect( $redirect ); 408 exit; 409 } 410 411 if ( ! current_user_can( 'remove_users' ) ) { 412 wp_die( __( 'Sorry, you are not allowed to remove users.' ), 403 ); 413 } 414 415 $userids = $_REQUEST['users']; 416 417 $update = 'remove'; 418 foreach ( $userids as $id ) { 419 $id = (int) $id; 420 if ( ! current_user_can( 'remove_user', $id ) ) { 421 $update = 'err_admin_remove'; 422 continue; 423 } 424 remove_user_from_blog( $id, $blog_id ); 425 } 426 427 $redirect = add_query_arg( array( 'update' => $update ), $redirect ); 428 wp_redirect( $redirect ); 429 exit; 430 431 case 'remove': 432 check_admin_referer( 'bulk-users' ); 433 434 if ( ! is_multisite() ) { 435 wp_die( __( 'You can’t remove users.' ), 400 ); 436 } 437 438 if ( empty( $_REQUEST['users'] ) && empty( $_REQUEST['user'] ) ) { 439 wp_redirect( $redirect ); 440 exit; 441 } 442 443 if ( ! current_user_can( 'remove_users' ) ) { 444 $error = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to remove users.' ) ); 445 } 446 447 if ( empty( $_REQUEST['users'] ) ) { 448 $userids = array( (int) $_REQUEST['user'] ); 449 } else { 450 $userids = $_REQUEST['users']; 451 } 452 453 require_once ABSPATH . 'wp-admin/admin-header.php'; 454 ?> 455 <form method="post" name="updateusers" id="updateusers"> 456 <?php wp_nonce_field( 'remove-users' ); ?> 457 <?php echo $referer; ?> 458 459<div class="wrap"> 460<h1><?php _e( 'Remove Users from Site' ); ?></h1> 461 462 <?php if ( 1 === count( $userids ) ) : ?> 463 <p><?php _e( 'You have specified this user for removal:' ); ?></p> 464 <?php else : ?> 465 <p><?php _e( 'You have specified these users for removal:' ); ?></p> 466 <?php endif; ?> 467 468<ul> 469 <?php 470 $go_remove = false; 471 foreach ( $userids as $id ) { 472 $id = (int) $id; 473 $user = get_userdata( $id ); 474 if ( ! current_user_can( 'remove_user', $id ) ) { 475 /* translators: 1: User ID, 2: User login. */ 476 echo '<li>' . sprintf( __( 'ID #%1$s: %2$s <strong>Sorry, you are not allowed to remove this user.</strong>' ), $id, $user->user_login ) . "</li>\n"; 477 } else { 478 /* translators: 1: User ID, 2: User login. */ 479 echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf( __( 'ID #%1$s: %2$s' ), $id, $user->user_login ) . "</li>\n"; 480 $go_remove = true; 481 } 482 } 483 ?> 484 </ul> 485 <?php if ( $go_remove ) : ?> 486 <input type="hidden" name="action" value="doremove" /> 487 <?php submit_button( __( 'Confirm Removal' ), 'primary' ); ?> 488 <?php else : ?> 489 <p><?php _e( 'There are no valid users selected for removal.' ); ?></p> 490 <?php endif; ?> 491 </div> 492 </form> 493 <?php 494 495 break; 496 497 default: 498 if ( ! empty( $_GET['_wp_http_referer'] ) ) { 499 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 500 exit; 501 } 502 503 if ( $wp_list_table->current_action() && ! empty( $_REQUEST['users'] ) ) { 504 $screen = get_current_screen()->id; 505 $sendback = wp_get_referer(); 506 $userids = $_REQUEST['users']; 507 508 /** This action is documented in wp-admin/edit.php */ 509 $sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $wp_list_table->current_action(), $userids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 510 511 wp_safe_redirect( $sendback ); 512 exit; 513 } 514 515 $wp_list_table->prepare_items(); 516 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 517 if ( $pagenum > $total_pages && $total_pages > 0 ) { 518 wp_redirect( add_query_arg( 'paged', $total_pages ) ); 519 exit; 520 } 521 522 require_once ABSPATH . 'wp-admin/admin-header.php'; 523 524 $messages = array(); 525 if ( isset( $_GET['update'] ) ) : 526 switch ( $_GET['update'] ) { 527 case 'del': 528 case 'del_many': 529 $delete_count = isset( $_GET['delete_count'] ) ? (int) $_GET['delete_count'] : 0; 530 if ( 1 == $delete_count ) { 531 $message = __( 'User deleted.' ); 532 } else { 533 /* translators: %s: Number of users. */ 534 $message = _n( '%s user deleted.', '%s users deleted.', $delete_count ); 535 } 536 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; 537 break; 538 case 'add': 539 $message = __( 'New user created.' ); 540 541 $user_id = isset( $_GET['id'] ) ? $_GET['id'] : false; 542 if ( $user_id && current_user_can( 'edit_user', $user_id ) ) { 543 $message .= sprintf( 544 ' <a href="%s">%s</a>', 545 esc_url( 546 add_query_arg( 547 'wp_http_referer', 548 urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 549 self_admin_url( 'user-edit.php?user_id=' . $user_id ) 550 ) 551 ), 552 __( 'Edit user' ) 553 ); 554 } 555 556 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>'; 557 break; 558 case 'resetpassword': 559 $reset_count = isset( $_GET['reset_count'] ) ? (int) $_GET['reset_count'] : 0; 560 if ( 1 === $reset_count ) { 561 $message = __( 'Password reset link sent.' ); 562 } else { 563 /* translators: %s: Number of users. */ 564 $message = _n( 'Password reset links sent to %s user.', 'Password reset links sent to %s users.', $reset_count ); 565 } 566 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $reset_count ) ) . '</p></div>'; 567 break; 568 case 'promote': 569 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>'; 570 break; 571 case 'err_admin_role': 572 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'The current user’s role must have user editing capabilities.' ) . '</p></div>'; 573 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Other user roles have been changed.' ) . '</p></div>'; 574 break; 575 case 'err_admin_del': 576 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'You can’t delete the current user.' ) . '</p></div>'; 577 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Other users have been deleted.' ) . '</p></div>'; 578 break; 579 case 'remove': 580 $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'User removed from this site.' ) . '</p></div>'; 581 break; 582 case 'err_admin_remove': 583 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( "You can't remove the current user." ) . '</p></div>'; 584 $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'Other users have been removed.' ) . '</p></div>'; 585 break; 586 } 587 endif; 588 ?> 589 590 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?> 591 <div class="error"> 592 <ul> 593 <?php 594 foreach ( $errors->get_error_messages() as $err ) { 595 echo "<li>$err</li>\n"; 596 } 597 ?> 598 </ul> 599 </div> 600 <?php 601 endif; 602 603 if ( ! empty( $messages ) ) { 604 foreach ( $messages as $msg ) { 605 echo $msg; 606 } 607 } 608 ?> 609 610 <div class="wrap"> 611 <h1 class="wp-heading-inline"> 612 <?php 613 echo esc_html( $title ); 614 ?> 615</h1> 616 617 <?php 618 if ( current_user_can( 'create_users' ) ) { 619 ?> 620 <a href="<?php echo esc_url( admin_url( 'user-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a> 621<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?> 622 <a href="<?php echo esc_url( admin_url( 'user-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> 623 <?php 624} 625 626if ( strlen( $usersearch ) ) { 627 echo '<span class="subtitle">'; 628 printf( 629 /* translators: %s: Search query. */ 630 __( 'Search results for: %s' ), 631 '<strong>' . esc_html( $usersearch ) . '</strong>' 632 ); 633 echo '</span>'; 634} 635?> 636 637<hr class="wp-header-end"> 638 639 <?php $wp_list_table->views(); ?> 640 641<form method="get"> 642 643 <?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?> 644 645 <?php if ( ! empty( $_REQUEST['role'] ) ) { ?> 646<input type="hidden" name="role" value="<?php echo esc_attr( $_REQUEST['role'] ); ?>" /> 647<?php } ?> 648 649 <?php $wp_list_table->display(); ?> 650</form> 651 652<div class="clear"></div> 653</div> 654 <?php 655 break; 656 657} // End of the $doaction switch. 658 659require_once ABSPATH . 'wp-admin/admin-footer.php'; 660