6 * @subpackage Administration |
6 * @subpackage Administration |
7 * @since 1.0.0 |
7 * @since 1.0.0 |
8 */ |
8 */ |
9 |
9 |
10 /** WordPress Administration Bootstrap */ |
10 /** WordPress Administration Bootstrap */ |
11 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 require_once __DIR__ . '/admin.php'; |
12 |
12 |
13 if ( ! current_user_can( 'list_users' ) ) { |
13 if ( ! current_user_can( 'list_users' ) ) { |
14 wp_die( |
14 wp_die( |
15 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
15 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
16 '<p>' . __( 'Sorry, you are not allowed to list users.' ) . '</p>', |
16 '<p>' . __( 'Sorry, you are not allowed to list users.' ) . '</p>', |
23 $title = __( 'Users' ); |
23 $title = __( 'Users' ); |
24 $parent_file = 'users.php'; |
24 $parent_file = 'users.php'; |
25 |
25 |
26 add_screen_option( 'per_page' ); |
26 add_screen_option( 'per_page' ); |
27 |
27 |
28 // contextual help - choose Help on the top right of admin panel to preview this. |
28 // Contextual help - choose Help on the top right of admin panel to preview this. |
29 get_current_screen()->add_help_tab( |
29 get_current_screen()->add_help_tab( |
30 array( |
30 array( |
31 'id' => 'overview', |
31 'id' => 'overview', |
32 'title' => __( '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>' . |
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>' . |
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>' . |
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>' . |
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>'; |
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 |
54 |
55 if ( is_multisite() ) { |
55 if ( 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>'; |
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 { |
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>'; |
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 } |
59 } |
60 |
60 |
61 $help .= '</ul>'; |
61 $help .= '</ul>'; |
62 |
62 |
63 get_current_screen()->add_help_tab( |
63 get_current_screen()->add_help_tab( |
69 ); |
69 ); |
70 unset( $help ); |
70 unset( $help ); |
71 |
71 |
72 get_current_screen()->set_help_sidebar( |
72 get_current_screen()->set_help_sidebar( |
73 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
73 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
74 '<p>' . __( '<a href="https://codex.wordpress.org/Users_Screen">Documentation on Managing Users</a>' ) . '</p>' . |
74 '<p>' . __( '<a href="https://wordpress.org/support/article/users-screen/">Documentation on Managing Users</a>' ) . '</p>' . |
75 '<p>' . __( '<a href="https://codex.wordpress.org/Roles_and_Capabilities">Descriptions of Roles and Capabilities</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>' |
76 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
77 ); |
77 ); |
78 |
78 |
79 get_current_screen()->set_screen_reader_content( |
79 get_current_screen()->set_screen_reader_content( |
80 array( |
80 array( |
129 $id = (int) $id; |
129 $id = (int) $id; |
130 |
130 |
131 if ( ! current_user_can( 'promote_user', $id ) ) { |
131 if ( ! current_user_can( 'promote_user', $id ) ) { |
132 wp_die( __( 'Sorry, you are not allowed to edit this user.' ), 403 ); |
132 wp_die( __( 'Sorry, you are not allowed to edit this user.' ), 403 ); |
133 } |
133 } |
134 // The new role of the current user must also have the promote_users cap or be a multisite super admin |
134 |
|
135 // The new role of the current user must also have the promote_users cap or be a multisite super admin. |
135 if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap( 'promote_users' ) |
136 if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap( 'promote_users' ) |
136 && ! ( is_multisite() && current_user_can( 'manage_network_users' ) ) ) { |
137 && ! ( is_multisite() && current_user_can( 'manage_network_users' ) ) ) { |
137 $update = 'err_admin_role'; |
138 $update = 'err_admin_role'; |
138 continue; |
139 continue; |
139 } |
140 } |
150 $user = get_userdata( $id ); |
151 $user = get_userdata( $id ); |
151 $user->set_role( $role ); |
152 $user->set_role( $role ); |
152 } |
153 } |
153 |
154 |
154 wp_redirect( add_query_arg( 'update', $update, $redirect ) ); |
155 wp_redirect( add_query_arg( 'update', $update, $redirect ) ); |
155 exit(); |
156 exit; |
156 |
157 |
157 case 'dodelete': |
158 case 'dodelete': |
158 if ( is_multisite() ) { |
159 if ( is_multisite() ) { |
159 wp_die( __( 'User deletion is not allowed from this screen.' ), 400 ); |
160 wp_die( __( 'User deletion is not allowed from this screen.' ), 400 ); |
160 } |
161 } |
161 |
162 |
162 check_admin_referer( 'delete-users' ); |
163 check_admin_referer( 'delete-users' ); |
163 |
164 |
164 if ( empty( $_REQUEST['users'] ) ) { |
165 if ( empty( $_REQUEST['users'] ) ) { |
165 wp_redirect( $redirect ); |
166 wp_redirect( $redirect ); |
166 exit(); |
167 exit; |
167 } |
168 } |
168 |
169 |
169 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
170 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
170 |
171 |
171 if ( empty( $_REQUEST['delete_option'] ) ) { |
172 if ( empty( $_REQUEST['delete_option'] ) ) { |
208 'update' => $update, |
209 'update' => $update, |
209 ), |
210 ), |
210 $redirect |
211 $redirect |
211 ); |
212 ); |
212 wp_redirect( $redirect ); |
213 wp_redirect( $redirect ); |
213 exit(); |
214 exit; |
214 |
215 |
215 case 'delete': |
216 case 'delete': |
216 if ( is_multisite() ) { |
217 if ( is_multisite() ) { |
217 wp_die( __( 'User deletion is not allowed from this screen.' ), 400 ); |
218 wp_die( __( 'User deletion is not allowed from this screen.' ), 400 ); |
218 } |
219 } |
219 |
220 |
220 check_admin_referer( 'bulk-users' ); |
221 check_admin_referer( 'bulk-users' ); |
221 |
222 |
222 if ( empty( $_REQUEST['users'] ) && empty( $_REQUEST['user'] ) ) { |
223 if ( empty( $_REQUEST['users'] ) && empty( $_REQUEST['user'] ) ) { |
223 wp_redirect( $redirect ); |
224 wp_redirect( $redirect ); |
224 exit(); |
225 exit; |
225 } |
226 } |
226 |
227 |
227 if ( ! current_user_can( 'delete_users' ) ) { |
228 if ( ! current_user_can( 'delete_users' ) ) { |
228 $errors = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to delete users.' ) ); |
229 $errors = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to delete users.' ) ); |
229 } |
230 } |
230 |
231 |
231 if ( empty( $_REQUEST['users'] ) ) { |
232 if ( empty( $_REQUEST['users'] ) ) { |
232 $userids = array( intval( $_REQUEST['user'] ) ); |
233 $userids = array( intval( $_REQUEST['user'] ) ); |
233 } else { |
234 } else { |
234 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
235 $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
236 } |
|
237 |
|
238 $all_userids = $userids; |
|
239 |
|
240 if ( in_array( $current_user->ID, $userids, true ) ) { |
|
241 $userids = array_diff( $userids, array( $current_user->ID ) ); |
235 } |
242 } |
236 |
243 |
237 /** |
244 /** |
238 * Filters whether the users being deleted have additional content |
245 * Filters whether the users being deleted have additional content |
239 * associated with them outside of the `post_author` and `link_owner` relationships. |
246 * associated with them outside of the `post_author` and `link_owner` relationships. |
240 * |
247 * |
241 * @since 5.2.0 |
248 * @since 5.2.0 |
242 * |
249 * |
243 * @param boolean $users_have_additional_content Whether the users have additional content. Default false. |
250 * @param bool $users_have_additional_content Whether the users have additional content. Default false. |
244 * @param int[] $userids Array of IDs for users being deleted. |
251 * @param int[] $userids Array of IDs for users being deleted. |
245 */ |
252 */ |
246 $users_have_content = (bool) apply_filters( 'users_have_additional_content', false, $userids ); |
253 $users_have_content = (bool) apply_filters( 'users_have_additional_content', false, $userids ); |
247 |
254 |
248 if ( ! $users_have_content ) { |
255 if ( $userids && ! $users_have_content ) { |
249 if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . ' ) LIMIT 1' ) ) { |
256 if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . ' ) LIMIT 1' ) ) { |
250 $users_have_content = true; |
257 $users_have_content = true; |
251 } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . ' ) LIMIT 1' ) ) { |
258 } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . ' ) LIMIT 1' ) ) { |
252 $users_have_content = true; |
259 $users_have_content = true; |
253 } |
260 } |
255 |
262 |
256 if ( $users_have_content ) { |
263 if ( $users_have_content ) { |
257 add_action( 'admin_head', 'delete_users_add_js' ); |
264 add_action( 'admin_head', 'delete_users_add_js' ); |
258 } |
265 } |
259 |
266 |
260 include( ABSPATH . 'wp-admin/admin-header.php' ); |
267 require_once ABSPATH . 'wp-admin/admin-header.php'; |
261 ?> |
268 ?> |
262 <form method="post" name="updateusers" id="updateusers"> |
269 <form method="post" name="updateusers" id="updateusers"> |
263 <?php wp_nonce_field( 'delete-users' ); ?> |
270 <?php wp_nonce_field( 'delete-users' ); ?> |
264 <?php echo $referer; ?> |
271 <?php echo $referer; ?> |
265 |
272 |
266 <div class="wrap"> |
273 <div class="wrap"> |
267 <h1><?php _e( 'Delete Users' ); ?></h1> |
274 <h1><?php _e( 'Delete Users' ); ?></h1> |
268 <?php if ( isset( $_REQUEST['error'] ) ) : ?> |
275 <?php if ( isset( $_REQUEST['error'] ) ) : ?> |
269 <div class="error"> |
276 <div class="error"> |
270 <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p> |
277 <p><strong><?php _e( 'Error:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p> |
271 </div> |
278 </div> |
272 <?php endif; ?> |
279 <?php endif; ?> |
273 |
280 |
274 <?php if ( 1 == count( $userids ) ) : ?> |
281 <?php if ( 1 === count( $all_userids ) ) : ?> |
275 <p><?php _e( 'You have specified this user for deletion:' ); ?></p> |
282 <p><?php _e( 'You have specified this user for deletion:' ); ?></p> |
276 <?php else : ?> |
283 <?php else : ?> |
277 <p><?php _e( 'You have specified these users for deletion:' ); ?></p> |
284 <p><?php _e( 'You have specified these users for deletion:' ); ?></p> |
278 <?php endif; ?> |
285 <?php endif; ?> |
279 |
286 |
280 <ul> |
287 <ul> |
281 <?php |
288 <?php |
282 $go_delete = 0; |
289 $go_delete = 0; |
283 foreach ( $userids as $id ) { |
290 foreach ( $all_userids as $id ) { |
284 $user = get_userdata( $id ); |
291 $user = get_userdata( $id ); |
285 if ( $id == $current_user->ID ) { |
292 if ( $id == $current_user->ID ) { |
286 /* translators: 1: user id, 2: user login */ |
293 /* translators: 1: User ID, 2: User login. */ |
287 echo '<li>' . sprintf( __( 'ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>' ), $id, $user->user_login ) . "</li>\n"; |
294 echo '<li>' . sprintf( __( 'ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>' ), $id, $user->user_login ) . "</li>\n"; |
288 } else { |
295 } else { |
289 /* translators: 1: user id, 2: user login */ |
296 /* translators: 1: User ID, 2: User login. */ |
290 echo '<li><input type="hidden" name="users[]" value="' . esc_attr( $id ) . '" />' . sprintf( __( 'ID #%1$s: %2$s' ), $id, $user->user_login ) . "</li>\n"; |
297 echo '<li><input type="hidden" name="users[]" value="' . esc_attr( $id ) . '" />' . sprintf( __( 'ID #%1$s: %2$s' ), $id, $user->user_login ) . "</li>\n"; |
291 $go_delete++; |
298 $go_delete++; |
292 } |
299 } |
293 } |
300 } |
294 ?> |
301 ?> |
384 wp_die( __( 'You can’t remove users.' ), 400 ); |
391 wp_die( __( 'You can’t remove users.' ), 400 ); |
385 } |
392 } |
386 |
393 |
387 if ( empty( $_REQUEST['users'] ) && empty( $_REQUEST['user'] ) ) { |
394 if ( empty( $_REQUEST['users'] ) && empty( $_REQUEST['user'] ) ) { |
388 wp_redirect( $redirect ); |
395 wp_redirect( $redirect ); |
389 exit(); |
396 exit; |
390 } |
397 } |
391 |
398 |
392 if ( ! current_user_can( 'remove_users' ) ) { |
399 if ( ! current_user_can( 'remove_users' ) ) { |
393 $error = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to remove users.' ) ); |
400 $error = new WP_Error( 'edit_users', __( 'Sorry, you are not allowed to remove users.' ) ); |
394 } |
401 } |
397 $userids = array( intval( $_REQUEST['user'] ) ); |
404 $userids = array( intval( $_REQUEST['user'] ) ); |
398 } else { |
405 } else { |
399 $userids = $_REQUEST['users']; |
406 $userids = $_REQUEST['users']; |
400 } |
407 } |
401 |
408 |
402 include( ABSPATH . 'wp-admin/admin-header.php' ); |
409 require_once ABSPATH . 'wp-admin/admin-header.php'; |
403 ?> |
410 ?> |
404 <form method="post" name="updateusers" id="updateusers"> |
411 <form method="post" name="updateusers" id="updateusers"> |
405 <?php wp_nonce_field( 'remove-users' ); ?> |
412 <?php wp_nonce_field( 'remove-users' ); ?> |
406 <?php echo $referer; ?> |
413 <?php echo $referer; ?> |
407 |
414 |
408 <div class="wrap"> |
415 <div class="wrap"> |
409 <h1><?php _e( 'Remove Users from Site' ); ?></h1> |
416 <h1><?php _e( 'Remove Users from Site' ); ?></h1> |
410 |
417 |
411 <?php if ( 1 == count( $userids ) ) : ?> |
418 <?php if ( 1 === count( $userids ) ) : ?> |
412 <p><?php _e( 'You have specified this user for removal:' ); ?></p> |
419 <p><?php _e( 'You have specified this user for removal:' ); ?></p> |
413 <?php else : ?> |
420 <?php else : ?> |
414 <p><?php _e( 'You have specified these users for removal:' ); ?></p> |
421 <p><?php _e( 'You have specified these users for removal:' ); ?></p> |
415 <?php endif; ?> |
422 <?php endif; ?> |
416 |
423 |
419 $go_remove = false; |
426 $go_remove = false; |
420 foreach ( $userids as $id ) { |
427 foreach ( $userids as $id ) { |
421 $id = (int) $id; |
428 $id = (int) $id; |
422 $user = get_userdata( $id ); |
429 $user = get_userdata( $id ); |
423 if ( ! current_user_can( 'remove_user', $id ) ) { |
430 if ( ! current_user_can( 'remove_user', $id ) ) { |
424 /* translators: 1: user id, 2: user login */ |
431 /* translators: 1: User ID, 2: User login. */ |
425 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"; |
432 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"; |
426 } else { |
433 } else { |
427 /* translators: 1: user id, 2: user login */ |
434 /* translators: 1: User ID, 2: User login. */ |
428 echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf( __( 'ID #%1$s: %2$s' ), $id, $user->user_login ) . "</li>\n"; |
435 echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf( __( 'ID #%1$s: %2$s' ), $id, $user->user_login ) . "</li>\n"; |
429 $go_remove = true; |
436 $go_remove = true; |
430 } |
437 } |
431 } |
438 } |
432 ?> |
439 ?> |
448 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
455 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
449 exit; |
456 exit; |
450 } |
457 } |
451 |
458 |
452 if ( $wp_list_table->current_action() && ! empty( $_REQUEST['users'] ) ) { |
459 if ( $wp_list_table->current_action() && ! empty( $_REQUEST['users'] ) ) { |
|
460 $screen = get_current_screen()->id; |
|
461 $sendback = wp_get_referer(); |
453 $userids = $_REQUEST['users']; |
462 $userids = $_REQUEST['users']; |
454 $sendback = wp_get_referer(); |
463 |
455 |
464 /** This action is documented in wp-admin/edit.php */ |
456 /** This action is documented in wp-admin/edit-comments.php */ |
465 $sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $wp_list_table->current_action(), $userids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
457 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $wp_list_table->current_action(), $userids ); |
|
458 |
466 |
459 wp_safe_redirect( $sendback ); |
467 wp_safe_redirect( $sendback ); |
460 exit; |
468 exit; |
461 } |
469 } |
462 |
470 |
465 if ( $pagenum > $total_pages && $total_pages > 0 ) { |
473 if ( $pagenum > $total_pages && $total_pages > 0 ) { |
466 wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
474 wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
467 exit; |
475 exit; |
468 } |
476 } |
469 |
477 |
470 include( ABSPATH . 'wp-admin/admin-header.php' ); |
478 require_once ABSPATH . 'wp-admin/admin-header.php'; |
471 |
479 |
472 $messages = array(); |
480 $messages = array(); |
473 if ( isset( $_GET['update'] ) ) : |
481 if ( isset( $_GET['update'] ) ) : |
474 switch ( $_GET['update'] ) { |
482 switch ( $_GET['update'] ) { |
475 case 'del': |
483 case 'del': |
476 case 'del_many': |
484 case 'del_many': |
477 $delete_count = isset( $_GET['delete_count'] ) ? (int) $_GET['delete_count'] : 0; |
485 $delete_count = isset( $_GET['delete_count'] ) ? (int) $_GET['delete_count'] : 0; |
478 if ( 1 == $delete_count ) { |
486 if ( 1 == $delete_count ) { |
479 $message = __( 'User deleted.' ); |
487 $message = __( 'User deleted.' ); |
480 } else { |
488 } else { |
|
489 /* translators: %s: Number of users. */ |
481 $message = _n( '%s user deleted.', '%s users deleted.', $delete_count ); |
490 $message = _n( '%s user deleted.', '%s users deleted.', $delete_count ); |
482 } |
491 } |
483 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; |
492 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; |
484 break; |
493 break; |
485 case 'add': |
494 case 'add': |
486 if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { |
495 $message = __( 'New user created.' ); |
487 /* translators: %s: edit page url */ |
496 |
488 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( |
497 $user_id = isset( $_GET['id'] ) ? $_GET['id'] : false; |
489 __( 'New user created. <a href="%s">Edit user</a>' ), |
498 if ( $user_id && current_user_can( 'edit_user', $user_id ) ) { |
|
499 $message .= sprintf( |
|
500 ' <a href="%s">%s</a>', |
490 esc_url( |
501 esc_url( |
491 add_query_arg( |
502 add_query_arg( |
492 'wp_http_referer', |
503 'wp_http_referer', |
493 urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), |
504 urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), |
494 self_admin_url( 'user-edit.php?user_id=' . $user_id ) |
505 self_admin_url( 'user-edit.php?user_id=' . $user_id ) |
495 ) |
506 ) |
496 ) |
507 ), |
497 ) . '</p></div>'; |
508 __( 'Edit user' ) |
498 } else { |
509 ); |
499 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>'; |
|
500 } |
510 } |
|
511 |
|
512 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>'; |
501 break; |
513 break; |
502 case 'promote': |
514 case 'promote': |
503 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>'; |
515 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>'; |
504 break; |
516 break; |
505 case 'err_admin_role': |
517 case 'err_admin_role': |
556 <a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> |
568 <a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> |
557 <?php |
569 <?php |
558 } |
570 } |
559 |
571 |
560 if ( strlen( $usersearch ) ) { |
572 if ( strlen( $usersearch ) ) { |
561 /* translators: %s: search keywords */ |
573 /* translators: %s: Search query. */ |
562 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $usersearch ) ); |
574 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $usersearch ) ); |
563 } |
575 } |
564 ?> |
576 ?> |
565 |
577 |
566 <hr class="wp-header-end"> |
578 <hr class="wp-header-end"> |