}
if ( is_multisite() ) {
+ /**
+ *
+ * @param string $text
+ * @return string
+ */
function admin_created_user_email( $text ) {
$roles = get_editable_roles();
$role = $roles[ $_REQUEST['role'] ];
get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
- '<p>' . __('<a href="http://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
+ '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
wp_enqueue_script('wp-ajax-response');
-wp_enqueue_script('user-profile');
+wp_enqueue_script( 'user-profile' );
/**
* Filter whether to enable user auto-complete for non-super admins in Multisite.
}
?>
<div class="wrap">
-<h2 id="add-new-user"> <?php
+<h1 id="add-new-user"><?php
if ( current_user_can( 'create_users' ) ) {
echo _x( 'Add New User', 'user' );
} elseif ( current_user_can( 'promote_users' ) ) {
echo _x( 'Add Existing User', 'user' );
} ?>
-</h2>
+</h1>
<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
<div class="error">
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg )
- echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+ echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
} ?>
<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
$type = 'text';
}
?>
-<form action="" method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"<?php
+<form method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"<?php
/**
* Fires inside the adduser form tag.
*
*/
do_action( 'user_new_form', 'add-existing-user' );
?>
-<?php submit_button( __( 'Add Existing User '), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
+<?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
</form>
<?php
} // is_multisite()
echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>';
?>
<p><?php _e('Create a brand new user and add them to this site.'); ?></p>
-<form action="" method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php
+<form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php
/** This action is documented in wp-admin/user-new.php */
do_action( 'user_new_form_tag' );
?>>
$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
-$new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : '';
+$new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true;
$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
?>
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
- <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td>
+ <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" /></td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
* @param bool $show Whether to show the password fields. Default true.
*/
if ( apply_filters( 'show_password_fields', true ) ) : ?>
- <tr class="form-field form-required">
- <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
+ <tr class="form-field form-required user-pass1-wrap">
+ <th scope="row">
+ <label for="pass1">
+ <?php _e( 'Password' ); ?>
+ <span class="description hide-if-js"><?php _e( '(required)' ); ?></span>
+ </label>
+ </th>
<td>
<input class="hidden" value=" " /><!-- #24364 workaround -->
- <input name="pass1" type="password" id="pass1" autocomplete="off" />
+ <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button>
+ <div class="wp-pwd hide-if-js">
+ <?php $initial_password = wp_generate_password( 24 ); ?>
+ <span class="password-input-wrapper">
+ <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
+ </span>
+ <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
+ <span class="dashicons dashicons-hidden"></span>
+ <span class="text"><?php _e( 'Hide' ); ?></span>
+ </button>
+ <button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">
+ <span class="text"><?php _e( 'Cancel' ); ?></span>
+ </button>
+ <div style="display:none" id="pass-strength-result" aria-live="polite"></div>
+ </div>
+ <p><span class="description"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></span></p>
</td>
</tr>
- <tr class="form-field form-required">
- <th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
+ <tr class="form-field form-required user-pass2-wrap hide-if-js">
+ <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
<td>
<input name="pass2" type="password" id="pass2" autocomplete="off" />
- <br />
- <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
- <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
</td>
</tr>
- <tr>
- <th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th>
- <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" value="1" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
+ <tr class="pw-weak">
+ <th><?php _e( 'Confirm Password' ); ?></th>
+ <td>
+ <label>
+ <input type="checkbox" name="pw_weak" class="pw-checkbox" />
+ <?php _e( 'Confirm use of weak password' ); ?>
+ </label>
+ </td>
</tr>
<?php endif; ?>
<?php } // !is_multisite ?>
do_action( 'user_new_form', 'add-new-user' );
?>
-<?php submit_button( __( 'Add New User '), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
+<?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
</form>
<?php } // current_user_can('create_users') ?>