[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * New User Administration Screen. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once __DIR__ . '/admin.php'; 11 12 if ( is_multisite() ) { 13 if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) { 14 wp_die( 15 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 16 '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>', 17 403 18 ); 19 } 20 } elseif ( ! current_user_can( 'create_users' ) ) { 21 wp_die( 22 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 23 '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>', 24 403 25 ); 26 } 27 28 if ( is_multisite() ) { 29 add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); 30 } 31 32 if ( isset( $_REQUEST['action'] ) && 'adduser' === $_REQUEST['action'] ) { 33 check_admin_referer( 'add-user', '_wpnonce_add-user' ); 34 35 $user_details = null; 36 $user_email = wp_unslash( $_REQUEST['email'] ); 37 if ( false !== strpos( $user_email, '@' ) ) { 38 $user_details = get_user_by( 'email', $user_email ); 39 } else { 40 if ( current_user_can( 'manage_network_users' ) ) { 41 $user_details = get_user_by( 'login', $user_email ); 42 } else { 43 wp_redirect( add_query_arg( array( 'update' => 'enter_email' ), 'user-new.php' ) ); 44 die(); 45 } 46 } 47 48 if ( ! $user_details ) { 49 wp_redirect( add_query_arg( array( 'update' => 'does_not_exist' ), 'user-new.php' ) ); 50 die(); 51 } 52 53 if ( ! current_user_can( 'promote_user', $user_details->ID ) ) { 54 wp_die( 55 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 56 '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>', 57 403 58 ); 59 } 60 61 // Adding an existing user to this blog. 62 $new_user_email = array(); 63 $redirect = 'user-new.php'; 64 $username = $user_details->user_login; 65 $user_id = $user_details->ID; 66 if ( null != $username && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) { 67 $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' ); 68 } else { 69 if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) { 70 $result = add_existing_user_to_blog( 71 array( 72 'user_id' => $user_id, 73 'role' => $_REQUEST['role'], 74 ) 75 ); 76 77 if ( ! is_wp_error( $result ) ) { 78 $redirect = add_query_arg( 79 array( 80 'update' => 'addnoconfirmation', 81 'user_id' => $user_id, 82 ), 83 'user-new.php' 84 ); 85 } else { 86 $redirect = add_query_arg( array( 'update' => 'could_not_add' ), 'user-new.php' ); 87 } 88 } else { 89 $newuser_key = wp_generate_password( 20, false ); 90 add_option( 91 'new_user_' . $newuser_key, 92 array( 93 'user_id' => $user_id, 94 'email' => $user_details->user_email, 95 'role' => $_REQUEST['role'], 96 ) 97 ); 98 99 $roles = get_editable_roles(); 100 $role = $roles[ $_REQUEST['role'] ]; 101 102 /** 103 * Fires immediately after an existing user is invited to join the site, but before the notification is sent. 104 * 105 * @since 4.4.0 106 * 107 * @param int $user_id The invited user's ID. 108 * @param array $role Array containing role information for the invited user. 109 * @param string $newuser_key The key of the invitation. 110 */ 111 do_action( 'invite_user', $user_id, $role, $newuser_key ); 112 113 $switched_locale = switch_to_locale( get_user_locale( $user_details ) ); 114 115 if ( '' !== get_option( 'blogname' ) ) { 116 $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 117 } else { 118 $site_title = parse_url( home_url(), PHP_URL_HOST ); 119 } 120 121 /* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */ 122 $message = __( 123 'Hi, 124 125 You\'ve been invited to join \'%1$s\' at 126 %2$s with the role of %3$s. 127 128 Please click the following link to confirm the invite: 129 %4$s' 130 ); 131 132 $new_user_email['to'] = $user_details->user_email; 133 $new_user_email['subject'] = sprintf( 134 /* translators: Joining confirmation notification email subject. %s: Site title. */ 135 __( '[%s] Joining Confirmation' ), 136 $site_title 137 ); 138 $new_user_email['message'] = sprintf( 139 $message, 140 get_option( 'blogname' ), 141 home_url(), 142 wp_specialchars_decode( translate_user_role( $role['name'] ) ), 143 home_url( "/newbloguser/$newuser_key/" ) 144 ); 145 $new_user_email['headers'] = ''; 146 147 /** 148 * Filters the contents of the email sent when an existing user is invited to join the site. 149 * 150 * @since 5.6.0 151 * 152 * @param array $new_user_email { 153 * Used to build wp_mail(). 154 * 155 * @type string $to The email address of the invited user. 156 * @type string $subject The subject of the email. 157 * @type string $message The content of the email. 158 * @type string $headers Headers. 159 * } 160 * @param int $user_id The invited user's ID. 161 * @param array $role Array containing role information for the invited user. 162 * @param string $newuser_key The key of the invitation. 163 * 164 */ 165 $new_user_email = apply_filters( 'invited_user_email', $new_user_email, $user_id, $role, $newuser_key ); 166 167 wp_mail( 168 $new_user_email['to'], 169 $new_user_email['subject'], 170 $new_user_email['message'], 171 $new_user_email['headers'] 172 ); 173 174 if ( $switched_locale ) { 175 restore_previous_locale(); 176 } 177 178 $redirect = add_query_arg( array( 'update' => 'add' ), 'user-new.php' ); 179 } 180 } 181 wp_redirect( $redirect ); 182 die(); 183 } elseif ( isset( $_REQUEST['action'] ) && 'createuser' === $_REQUEST['action'] ) { 184 check_admin_referer( 'create-user', '_wpnonce_create-user' ); 185 186 if ( ! current_user_can( 'create_users' ) ) { 187 wp_die( 188 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . 189 '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>', 190 403 191 ); 192 } 193 194 if ( ! is_multisite() ) { 195 $user_id = edit_user(); 196 197 if ( is_wp_error( $user_id ) ) { 198 $add_user_errors = $user_id; 199 } else { 200 if ( current_user_can( 'list_users' ) ) { 201 $redirect = 'users.php?update=add&id=' . $user_id; 202 } else { 203 $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); 204 } 205 wp_redirect( $redirect ); 206 die(); 207 } 208 } else { 209 // Adding a new user to this site. 210 $new_user_email = wp_unslash( $_REQUEST['email'] ); 211 $user_details = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email ); 212 if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) { 213 $add_user_errors = $user_details['errors']; 214 } else { 215 /** This filter is documented in wp-includes/user.php */ 216 $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); 217 if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) { 218 add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email. 219 add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email. 220 } 221 wpmu_signup_user( 222 $new_user_login, 223 $new_user_email, 224 array( 225 'add_to_blog' => get_current_blog_id(), 226 'new_role' => $_REQUEST['role'], 227 ) 228 ); 229 if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) { 230 $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) ); 231 $new_user = wpmu_activate_signup( $key ); 232 if ( is_wp_error( $new_user ) ) { 233 $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' ); 234 } elseif ( ! is_user_member_of_blog( $new_user['user_id'] ) ) { 235 $redirect = add_query_arg( array( 'update' => 'created_could_not_add' ), 'user-new.php' ); 236 } else { 237 $redirect = add_query_arg( 238 array( 239 'update' => 'addnoconfirmation', 240 'user_id' => $new_user['user_id'], 241 ), 242 'user-new.php' 243 ); 244 } 245 } else { 246 $redirect = add_query_arg( array( 'update' => 'newuserconfirmation' ), 'user-new.php' ); 247 } 248 wp_redirect( $redirect ); 249 die(); 250 } 251 } 252 } 253 254 // Used in the HTML title tag. 255 $title = __( 'Add New User' ); 256 $parent_file = 'users.php'; 257 258 $do_both = false; 259 if ( is_multisite() && current_user_can( 'promote_users' ) && current_user_can( 'create_users' ) ) { 260 $do_both = true; 261 } 262 263 $help = '<p>' . __( 'To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.' ) . '</p>'; 264 265 if ( is_multisite() ) { 266 $help .= '<p>' . __( 'Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user’s name to Edit the user profile under Network Admin > All Users.' ) . '</p>' . 267 '<p>' . __( 'New users will receive an email letting them know they’ve been added as a user for your site. This email will also contain their password. Check the box if you do not want the user to receive a welcome email.' ) . '</p>'; 268 } else { 269 $help .= '<p>' . __( 'New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.' ) . '</p>' . 270 271 '<p>' . __( 'By default, new users will receive an email letting them know they’ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you do not want to send the new user a welcome email.' ) . '</p>'; 272 } 273 274 $help .= '<p>' . __( 'Remember to click the Add New User button at the bottom of this screen when you are finished.' ) . '</p>'; 275 276 get_current_screen()->add_help_tab( 277 array( 278 'id' => 'overview', 279 'title' => __( 'Overview' ), 280 'content' => $help, 281 ) 282 ); 283 284 get_current_screen()->add_help_tab( 285 array( 286 'id' => 'user-roles', 287 'title' => __( 'User Roles' ), 288 'content' => '<p>' . __( 'Here is a basic overview of the different user roles and the permissions associated with each one:' ) . '</p>' . 289 '<ul>' . 290 '<li>' . __( 'Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.' ) . '</li>' . 291 '<li>' . __( 'Contributors can write and manage their posts but not publish posts or upload media files.' ) . '</li>' . 292 '<li>' . __( 'Authors can publish and manage their own posts, and are able to upload files.' ) . '</li>' . 293 '<li>' . __( 'Editors can publish posts, manage posts as well as manage other people’s posts, etc.' ) . '</li>' . 294 '<li>' . __( 'Administrators have access to all the administration features.' ) . '</li>' . 295 '</ul>', 296 ) 297 ); 298 299 get_current_screen()->set_help_sidebar( 300 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 301 '<p>' . __( '<a href="https://wordpress.org/support/article/users-add-new-screen/">Documentation on Adding New Users</a>' ) . '</p>' . 302 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 303 ); 304 305 wp_enqueue_script( 'wp-ajax-response' ); 306 wp_enqueue_script( 'user-profile' ); 307 308 /** 309 * Filters whether to enable user auto-complete for non-super admins in Multisite. 310 * 311 * @since 3.4.0 312 * 313 * @param bool $enable Whether to enable auto-complete for non-super admins. Default false. 314 */ 315 if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) 316 && ( current_user_can( 'manage_network_users' ) || apply_filters( 'autocomplete_users_for_site_admins', false ) ) 317 ) { 318 wp_enqueue_script( 'user-suggest' ); 319 } 320 321 require_once ABSPATH . 'wp-admin/admin-header.php'; 322 323 if ( isset( $_GET['update'] ) ) { 324 $messages = array(); 325 if ( is_multisite() ) { 326 $edit_link = ''; 327 if ( ( isset( $_GET['user_id'] ) ) ) { 328 $user_id_new = absint( $_GET['user_id'] ); 329 if ( $user_id_new ) { 330 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); 331 } 332 } 333 334 switch ( $_GET['update'] ) { 335 case 'newuserconfirmation': 336 $messages[] = __( 'Invitation email sent to new user. A confirmation link must be clicked before their account is created.' ); 337 break; 338 case 'add': 339 $messages[] = __( 'Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.' ); 340 break; 341 case 'addnoconfirmation': 342 $message = __( 'User has been added to your site.' ); 343 344 if ( $edit_link ) { 345 $message .= sprintf( ' <a href="%s">%s</a>', $edit_link, __( 'Edit user' ) ); 346 } 347 348 $messages[] = $message; 349 break; 350 case 'addexisting': 351 $messages[] = __( 'That user is already a member of this site.' ); 352 break; 353 case 'could_not_add': 354 $add_user_errors = new WP_Error( 'could_not_add', __( 'That user could not be added to this site.' ) ); 355 break; 356 case 'created_could_not_add': 357 $add_user_errors = new WP_Error( 'created_could_not_add', __( 'User has been created, but could not be added to this site.' ) ); 358 break; 359 case 'does_not_exist': 360 $add_user_errors = new WP_Error( 'does_not_exist', __( 'The requested user does not exist.' ) ); 361 break; 362 case 'enter_email': 363 $add_user_errors = new WP_Error( 'enter_email', __( 'Please enter a valid email address.' ) ); 364 break; 365 } 366 } else { 367 if ( 'add' === $_GET['update'] ) { 368 $messages[] = __( 'User added.' ); 369 } 370 } 371 } 372 ?> 373 <div class="wrap"> 374 <h1 id="add-new-user"> 375 <?php 376 if ( current_user_can( 'create_users' ) ) { 377 _e( 'Add New User' ); 378 } elseif ( current_user_can( 'promote_users' ) ) { 379 _e( 'Add Existing User' ); 380 } 381 ?> 382 </h1> 383 384 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?> 385 <div class="error"> 386 <ul> 387 <?php 388 foreach ( $errors->get_error_messages() as $err ) { 389 echo "<li>$err</li>\n"; 390 } 391 ?> 392 </ul> 393 </div> 394 <?php 395 endif; 396 397 if ( ! empty( $messages ) ) { 398 foreach ( $messages as $msg ) { 399 echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; 400 } 401 } 402 ?> 403 404 <?php if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) : ?> 405 <div class="error"> 406 <?php 407 foreach ( $add_user_errors->get_error_messages() as $message ) { 408 echo "<p>$message</p>"; 409 } 410 ?> 411 </div> 412 <?php endif; ?> 413 <div id="ajax-response"></div> 414 415 <?php 416 if ( is_multisite() && current_user_can( 'promote_users' ) ) { 417 if ( $do_both ) { 418 echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>'; 419 } 420 if ( ! current_user_can( 'manage_network_users' ) ) { 421 echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; 422 $label = __( 'Email' ); 423 $type = 'email'; 424 } else { 425 echo '<p>' . __( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; 426 $label = __( 'Email or Username' ); 427 $type = 'text'; 428 } 429 ?> 430 <form method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate" 431 <?php 432 /** 433 * Fires inside the adduser form tag. 434 * 435 * @since 3.0.0 436 */ 437 do_action( 'user_new_form_tag' ); 438 ?> 439 > 440 <input name="action" type="hidden" value="adduser" /> 441 <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?> 442 443 <table class="form-table" role="presentation"> 444 <tr class="form-field form-required"> 445 <th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th> 446 <td><input name="email" type="<?php echo $type; ?>" id="adduser-email" class="wp-suggest-user" value="" /></td> 447 </tr> 448 <tr class="form-field"> 449 <th scope="row"><label for="adduser-role"><?php _e( 'Role' ); ?></label></th> 450 <td><select name="role" id="adduser-role"> 451 <?php wp_dropdown_roles( get_option( 'default_role' ) ); ?> 452 </select> 453 </td> 454 </tr> 455 <?php if ( current_user_can( 'manage_network_users' ) ) { ?> 456 <tr> 457 <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th> 458 <td> 459 <input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> 460 <label for="adduser-noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label> 461 </td> 462 </tr> 463 <?php } ?> 464 </table> 465 <?php 466 /** 467 * Fires at the end of the new user form. 468 * 469 * Passes a contextual string to make both types of new user forms 470 * uniquely targetable. Contexts are 'add-existing-user' (Multisite), 471 * and 'add-new-user' (single site and network admin). 472 * 473 * @since 3.7.0 474 * 475 * @param string $type A contextual string specifying which type of new user form the hook follows. 476 */ 477 do_action( 'user_new_form', 'add-existing-user' ); 478 ?> 479 <?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?> 480 </form> 481 <?php 482 } // End if is_multisite(). 483 484 if ( current_user_can( 'create_users' ) ) { 485 if ( $do_both ) { 486 echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>'; 487 } 488 ?> 489 <p><?php _e( 'Create a brand new user and add them to this site.' ); ?></p> 490 <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate" 491 <?php 492 /** This action is documented in wp-admin/user-new.php */ 493 do_action( 'user_new_form_tag' ); 494 ?> 495 > 496 <input name="action" type="hidden" value="createuser" /> 497 <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?> 498 <?php 499 // Load up the passed data, else set to a default. 500 $creating = isset( $_POST['createuser'] ); 501 502 $new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : ''; 503 $new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : ''; 504 $new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : ''; 505 $new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : ''; 506 $new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : ''; 507 $new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : ''; 508 $new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true; 509 $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : ''; 510 511 ?> 512 <table class="form-table" role="presentation"> 513 <tr class="form-field form-required"> 514 <th scope="row"><label for="user_login"><?php _e( 'Username' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> 515 <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr( $new_user_login ); ?>" aria-required="true" autocapitalize="none" autocorrect="off" autocomplete="off" maxlength="60" /></td> 516 </tr> 517 <tr class="form-field form-required"> 518 <th scope="row"><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> 519 <td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td> 520 </tr> 521 <?php if ( ! is_multisite() ) { ?> 522 <tr class="form-field"> 523 <th scope="row"><label for="first_name"><?php _e( 'First Name' ); ?> </label></th> 524 <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr( $new_user_firstname ); ?>" /></td> 525 </tr> 526 <tr class="form-field"> 527 <th scope="row"><label for="last_name"><?php _e( 'Last Name' ); ?> </label></th> 528 <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr( $new_user_lastname ); ?>" /></td> 529 </tr> 530 <tr class="form-field"> 531 <th scope="row"><label for="url"><?php _e( 'Website' ); ?></label></th> 532 <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td> 533 </tr> 534 <?php 535 $languages = get_available_languages(); 536 if ( $languages ) : 537 ?> 538 <tr class="form-field user-language-wrap"> 539 <th scope="row"> 540 <label for="locale"> 541 <?php /* translators: The user language selection field label. */ ?> 542 <?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span> 543 </label> 544 </th> 545 <td> 546 <?php 547 wp_dropdown_languages( 548 array( 549 'name' => 'locale', 550 'id' => 'locale', 551 'selected' => 'site-default', 552 'languages' => $languages, 553 'show_available_translations' => false, 554 'show_option_site_default' => true, 555 ) 556 ); 557 ?> 558 </td> 559 </tr> 560 <?php endif; ?> 561 <tr class="form-field form-required user-pass1-wrap"> 562 <th scope="row"> 563 <label for="pass1"> 564 <?php _e( 'Password' ); ?> 565 <span class="description hide-if-js"><?php _e( '(required)' ); ?></span> 566 </label> 567 </th> 568 <td> 569 <input class="hidden" value=" " /><!-- #24364 workaround --> 570 <button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Generate password' ); ?></button> 571 <div class="wp-pwd"> 572 <?php $initial_password = wp_generate_password( 24 ); ?> 573 <span class="password-input-wrapper"> 574 <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="new-password" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> 575 </span> 576 <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> 577 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> 578 <span class="text"><?php _e( 'Hide' ); ?></span> 579 </button> 580 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> 581 </div> 582 </td> 583 </tr> 584 <tr class="form-field form-required user-pass2-wrap hide-if-js"> 585 <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> 586 <td> 587 <input name="pass2" type="password" id="pass2" autocomplete="new-password" aria-describedby="pass2-desc" /> 588 <p class="description" id="pass2-desc"><?php _e( 'Type the password again.' ); ?></p> 589 </td> 590 </tr> 591 <tr class="pw-weak"> 592 <th><?php _e( 'Confirm Password' ); ?></th> 593 <td> 594 <label> 595 <input type="checkbox" name="pw_weak" class="pw-checkbox" /> 596 <?php _e( 'Confirm use of weak password' ); ?> 597 </label> 598 </td> 599 </tr> 600 <tr> 601 <th scope="row"><?php _e( 'Send User Notification' ); ?></th> 602 <td> 603 <input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> /> 604 <label for="send_user_notification"><?php _e( 'Send the new user an email about their account.' ); ?></label> 605 </td> 606 </tr> 607 <?php } // End if ! is_multisite(). ?> 608 <?php if ( current_user_can( 'promote_users' ) ) { ?> 609 <tr class="form-field"> 610 <th scope="row"><label for="role"><?php _e( 'Role' ); ?></label></th> 611 <td><select name="role" id="role"> 612 <?php 613 if ( ! $new_user_role ) { 614 $new_user_role = get_option( 'default_role' ); 615 } 616 wp_dropdown_roles( $new_user_role ); 617 ?> 618 </select> 619 </td> 620 </tr> 621 <?php } ?> 622 <?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?> 623 <tr> 624 <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th> 625 <td> 626 <input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> 627 <label for="noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label> 628 </td> 629 </tr> 630 <?php } ?> 631 </table> 632 633 <?php 634 /** This action is documented in wp-admin/user-new.php */ 635 do_action( 'user_new_form', 'add-new-user' ); 636 ?> 637 638 <?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?> 639 640 </form> 641 <?php } // End if current_user_can( 'create_users' ). ?> 642 </div> 643 <?php 644 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |