wp/wp-admin/user-new.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   110 			 */
   110 			 */
   111 			do_action( 'invite_user', $user_id, $role, $newuser_key );
   111 			do_action( 'invite_user', $user_id, $role, $newuser_key );
   112 
   112 
   113 			$switched_locale = switch_to_locale( get_user_locale( $user_details ) );
   113 			$switched_locale = switch_to_locale( get_user_locale( $user_details ) );
   114 
   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 
   115 			/* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */
   121 			/* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */
   116 			$message = __(
   122 			$message = __(
   117 				'Hi,
   123 				'Hi,
   118 
   124 
   119 You\'ve been invited to join \'%1$s\' at
   125 You\'ve been invited to join \'%1$s\' at
   125 
   131 
   126 			$new_user_email['to']      = $user_details->user_email;
   132 			$new_user_email['to']      = $user_details->user_email;
   127 			$new_user_email['subject'] = sprintf(
   133 			$new_user_email['subject'] = sprintf(
   128 				/* translators: Joining confirmation notification email subject. %s: Site title. */
   134 				/* translators: Joining confirmation notification email subject. %s: Site title. */
   129 				__( '[%s] Joining Confirmation' ),
   135 				__( '[%s] Joining Confirmation' ),
   130 				wp_specialchars_decode( get_option( 'blogname' ) )
   136 				$site_title
   131 			);
   137 			);
   132 			$new_user_email['message'] = sprintf(
   138 			$new_user_email['message'] = sprintf(
   133 				$message,
   139 				$message,
   134 				get_option( 'blogname' ),
   140 				get_option( 'blogname' ),
   135 				home_url(),
   141 				home_url(),
   243 			die();
   249 			die();
   244 		}
   250 		}
   245 	}
   251 	}
   246 }
   252 }
   247 
   253 
       
   254 // Used in the HTML title tag.
   248 $title       = __( 'Add New User' );
   255 $title       = __( 'Add New User' );
   249 $parent_file = 'users.php';
   256 $parent_file = 'users.php';
   250 
   257 
   251 $do_both = false;
   258 $do_both = false;
   252 if ( is_multisite() && current_user_can( 'promote_users' ) && current_user_can( 'create_users' ) ) {
   259 if ( is_multisite() && current_user_can( 'promote_users' ) && current_user_can( 'create_users' ) ) {
   255 
   262 
   256 $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>';
   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>';
   257 
   264 
   258 if ( is_multisite() ) {
   265 if ( is_multisite() ) {
   259 	$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&#8217;s name to Edit the user profile under Network Admin > All Users.' ) . '</p>' .
   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&#8217;s name to Edit the user profile under Network Admin > All Users.' ) . '</p>' .
   260 	'<p>' . __( 'New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you don&#8217;t want the user to receive a welcome email.' ) . '</p>';
   267 	'<p>' . __( 'New users will receive an email letting them know they&#8217;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>';
   261 } else {
   268 } else {
   262 	$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>' .
   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>' .
   263 
   270 
   264 	'<p>' . __( 'By default, new users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you don&#8217;t want to send the new user a welcome email.' ) . '</p>';
   271 	'<p>' . __( 'By default, new users will receive an email letting them know they&#8217;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>';
   265 }
   272 }
   266 
   273 
   267 $help .= '<p>' . __( 'Remember to click the Add New User button at the bottom of this screen when you are finished.' ) . '</p>';
   274 $help .= '<p>' . __( 'Remember to click the Add New User button at the bottom of this screen when you are finished.' ) . '</p>';
   268 
   275 
   269 get_current_screen()->add_help_tab(
   276 get_current_screen()->add_help_tab(
   503 
   510 
   504 	?>
   511 	?>
   505 <table class="form-table" role="presentation">
   512 <table class="form-table" role="presentation">
   506 	<tr class="form-field form-required">
   513 	<tr class="form-field form-required">
   507 		<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
   514 		<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
   508 		<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" maxlength="60" /></td>
   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>
   509 	</tr>
   516 	</tr>
   510 	<tr class="form-field form-required">
   517 	<tr class="form-field form-required">
   511 		<th scope="row"><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
   518 		<th scope="row"><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
   512 		<td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
   519 		<td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
   513 	</tr>
   520 	</tr>
   562 			<input class="hidden" value=" " /><!-- #24364 workaround -->
   569 			<input class="hidden" value=" " /><!-- #24364 workaround -->
   563 			<button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Generate password' ); ?></button>
   570 			<button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Generate password' ); ?></button>
   564 			<div class="wp-pwd">
   571 			<div class="wp-pwd">
   565 				<?php $initial_password = wp_generate_password( 24 ); ?>
   572 				<?php $initial_password = wp_generate_password( 24 ); ?>
   566 				<span class="password-input-wrapper">
   573 				<span class="password-input-wrapper">
   567 					<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" />
   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" />
   568 				</span>
   575 				</span>
   569 				<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
   576 				<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
   570 					<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
   577 					<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
   571 					<span class="text"><?php _e( 'Hide' ); ?></span>
   578 					<span class="text"><?php _e( 'Hide' ); ?></span>
   572 				</button>
   579 				</button>
   575 		</td>
   582 		</td>
   576 	</tr>
   583 	</tr>
   577 	<tr class="form-field form-required user-pass2-wrap hide-if-js">
   584 	<tr class="form-field form-required user-pass2-wrap hide-if-js">
   578 		<th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
   585 		<th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
   579 		<td>
   586 		<td>
   580 		<input name="pass2" type="password" id="pass2" autocomplete="off" aria-describedby="pass2-desc" />
   587 		<input name="pass2" type="password" id="pass2" autocomplete="new-password" aria-describedby="pass2-desc" />
   581 		<p class="description" id="pass2-desc"><?php _e( 'Type the password again.' ); ?></p>
   588 		<p class="description" id="pass2-desc"><?php _e( 'Type the password again.' ); ?></p>
   582 		</td>
   589 		</td>
   583 	</tr>
   590 	</tr>
   584 	<tr class="pw-weak">
   591 	<tr class="pw-weak">
   585 		<th><?php _e( 'Confirm Password' ); ?></th>
   592 		<th><?php _e( 'Confirm Password' ); ?></th>