wp/wp-admin/user-edit.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     7  */
     7  */
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once __DIR__ . '/admin.php';
    10 require_once __DIR__ . '/admin.php';
    11 
    11 
    12 wp_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) );
    12 /** WordPress Translation Installation API */
    13 
    13 require_once ABSPATH . 'wp-admin/includes/translation-install.php';
    14 $user_id      = (int) $user_id;
    14 
       
    15 $action          = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
       
    16 $user_id         = ! empty( $_REQUEST['user_id'] ) ? absint( $_REQUEST['user_id'] ) : 0;
       
    17 $wp_http_referer = ! empty( $_REQUEST['wp_http_referer'] ) ? sanitize_text_field( $_REQUEST['wp_http_referer'] ) : '';
       
    18 
    15 $current_user = wp_get_current_user();
    19 $current_user = wp_get_current_user();
    16 
    20 
    17 if ( ! defined( 'IS_PROFILE_PAGE' ) ) {
    21 if ( ! defined( 'IS_PROFILE_PAGE' ) ) {
    18 	define( 'IS_PROFILE_PAGE', ( $user_id === $current_user->ID ) );
    22 	define( 'IS_PROFILE_PAGE', ( $user_id === $current_user->ID ) );
    19 }
    23 }
    69 	)
    73 	)
    70 );
    74 );
    71 
    75 
    72 get_current_screen()->set_help_sidebar(
    76 get_current_screen()->set_help_sidebar(
    73 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    77 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    74 	'<p>' . __( '<a href="https://wordpress.org/support/article/users-your-profile-screen/">Documentation on User Profiles</a>' ) . '</p>' .
    78 	'<p>' . __( '<a href="https://wordpress.org/documentation/article/users-your-profile-screen/">Documentation on User Profiles</a>' ) . '</p>' .
    75 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    79 	'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
    76 );
    80 );
    77 
    81 
    78 $wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer );
    82 $wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer );
    79 
    83 
    80 $user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
    84 $user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
   102 
   106 
   103 // Execute confirmed email change. See send_confirmation_on_profile_email().
   107 // Execute confirmed email change. See send_confirmation_on_profile_email().
   104 if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) {
   108 if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) {
   105 	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
   109 	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
   106 	if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) {
   110 	if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) {
   107 		$user             = new stdClass;
   111 		$user             = new stdClass();
   108 		$user->ID         = $current_user->ID;
   112 		$user->ID         = $current_user->ID;
   109 		$user->user_email = esc_html( trim( $new_email['newemail'] ) );
   113 		$user->user_email = esc_html( trim( $new_email['newemail'] ) );
   110 		if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
   114 		if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
   111 			$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
   115 			$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
   112 		}
   116 		}
   195 		$sessions = WP_Session_Tokens::get_instance( $profile_user->ID );
   199 		$sessions = WP_Session_Tokens::get_instance( $profile_user->ID );
   196 
   200 
   197 		require_once ABSPATH . 'wp-admin/admin-header.php';
   201 		require_once ABSPATH . 'wp-admin/admin-header.php';
   198 		?>
   202 		?>
   199 
   203 
   200 		<?php if ( ! IS_PROFILE_PAGE && is_super_admin( $profile_user->ID ) && current_user_can( 'manage_network_options' ) ) : ?>
   204 		<?php
   201 			<div class="notice notice-info"><p><strong><?php _e( 'Important:' ); ?></strong> <?php _e( 'This user has super admin privileges.' ); ?></p></div>
   205 		if ( ! IS_PROFILE_PAGE && is_super_admin( $profile_user->ID ) && current_user_can( 'manage_network_options' ) ) :
   202 		<?php endif; ?>
   206 			$message = '<strong>' . __( 'Important:' ) . '</strong> ' . __( 'This user has super admin privileges.' );
   203 
   207 			wp_admin_notice(
   204 		<?php if ( isset( $_GET['updated'] ) ) : ?>
   208 				$message,
   205 			<div id="message" class="updated notice is-dismissible">
   209 				array(
   206 				<?php if ( IS_PROFILE_PAGE ) : ?>
   210 					'type' => 'info',
   207 					<p><strong><?php _e( 'Profile updated.' ); ?></strong></p>
   211 				)
   208 				<?php else : ?>
   212 			);
   209 					<p><strong><?php _e( 'User updated.' ); ?></strong></p>
   213 		endif;
   210 				<?php endif; ?>
   214 
   211 				<?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
   215 		if ( isset( $_GET['updated'] ) ) :
   212 					<p><a href="<?php echo esc_url( wp_validate_redirect( esc_url_raw( $wp_http_referer ), self_admin_url( 'users.php' ) ) ); ?>"><?php _e( '&larr; Go to Users' ); ?></a></p>
   216 			if ( IS_PROFILE_PAGE ) :
   213 				<?php endif; ?>
   217 				$message = '<strong>' . __( 'Profile updated.' ) . '</strong>';
   214 			</div>
   218 			else :
   215 		<?php endif; ?>
   219 				$message = '<strong>' . __( 'User updated.' ) . '</strong>';
   216 
   220 			endif;
   217 		<?php if ( isset( $_GET['error'] ) ) : ?>
   221 			if ( $wp_http_referer && ! str_contains( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) :
   218 			<div class="notice notice-error">
   222 				$message .= '<a href="' . esc_url( wp_validate_redirect( sanitize_url( $wp_http_referer ), self_admin_url( 'users.php' ) ) ) . '">' . __( '&larr; Go to Users' ) . '</a>';
   219 			<?php if ( 'new-email' === $_GET['error'] ) : ?>
   223 			endif;
   220 				<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
   224 			wp_admin_notice(
   221 			<?php endif; ?>
   225 				$message,
   222 			</div>
   226 				array(
   223 		<?php endif; ?>
   227 					'id'                 => 'message',
   224 
   228 					'dismissible'        => true,
   225 		<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
   229 					'additional_classes' => array( 'updated' ),
   226 			<div class="error">
   230 				)
   227 				<p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p>
   231 			);
   228 			</div>
   232 		endif;
   229 		<?php endif; ?>
   233 
       
   234 		if ( isset( $_GET['error'] ) ) :
       
   235 			$message = '';
       
   236 			if ( 'new-email' === $_GET['error'] ) :
       
   237 				$message = __( 'Error while saving the new email address. Please try again.' );
       
   238 			endif;
       
   239 			wp_admin_notice(
       
   240 				$message,
       
   241 				array(
       
   242 					'type' => 'error',
       
   243 				)
       
   244 			);
       
   245 		endif;
       
   246 
       
   247 		if ( isset( $errors ) && is_wp_error( $errors ) ) {
       
   248 			wp_admin_notice(
       
   249 				implode( "</p>\n<p>", $errors->get_error_messages() ),
       
   250 				array(
       
   251 					'additional_classes' => array( 'error' ),
       
   252 				)
       
   253 			);
       
   254 		}
       
   255 		?>
   230 
   256 
   231 		<div class="wrap" id="profile-page">
   257 		<div class="wrap" id="profile-page">
   232 			<h1 class="wp-heading-inline">
   258 			<h1 class="wp-heading-inline">
   233 					<?php echo esc_html( $title ); ?>
   259 					<?php echo esc_html( $title ); ?>
   234 			</h1>
   260 			</h1>
   235 
   261 
   236 			<?php if ( ! IS_PROFILE_PAGE ) : ?>
   262 			<?php if ( ! IS_PROFILE_PAGE ) : ?>
   237 				<?php if ( current_user_can( 'create_users' ) ) : ?>
   263 				<?php if ( current_user_can( 'create_users' ) ) : ?>
   238 					<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
   264 					<a href="user-new.php" class="page-title-action"><?php echo esc_html__( 'Add New User' ); ?></a>
   239 				<?php elseif ( is_multisite() && current_user_can( 'promote_users' ) ) : ?>
   265 				<?php elseif ( is_multisite() && current_user_can( 'promote_users' ) ) : ?>
   240 					<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
   266 					<a href="user-new.php" class="page-title-action"><?php echo esc_html__( 'Add Existing User' ); ?></a>
   241 				<?php endif; ?>
   267 				<?php endif; ?>
   242 			<?php endif; ?>
   268 			<?php endif; ?>
   243 
   269 
   244 			<hr class="wp-header-end">
   270 			<hr class="wp-header-end">
   245 
   271 
   328 						<td>
   354 						<td>
   329 							<label for="comment_shortcuts">
   355 							<label for="comment_shortcuts">
   330 								<input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( 'true', $profile_user->comment_shortcuts ); ?> />
   356 								<input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( 'true', $profile_user->comment_shortcuts ); ?> />
   331 								<?php _e( 'Enable keyboard shortcuts for comment moderation.' ); ?>
   357 								<?php _e( 'Enable keyboard shortcuts for comment moderation.' ); ?>
   332 							</label>
   358 							</label>
   333 							<?php _e( '<a href="https://wordpress.org/support/article/keyboard-shortcuts/" target="_blank">More information</a>' ); ?>
   359 							<?php _e( '<a href="https://wordpress.org/documentation/article/keyboard-shortcuts-classic-editor/#keyboard-shortcuts-for-comments">Documentation on Keyboard Shortcuts</a>' ); ?>
   334 						</td>
   360 						</td>
   335 					</tr>
   361 					</tr>
   336 					<?php endif; ?>
   362 					<?php endif; ?>
   337 
   363 
   338 					<tr class="show-admin-bar user-admin-bar-front-wrap">
   364 					<tr class="show-admin-bar user-admin-bar-front-wrap">
   343 								<?php _e( 'Show Toolbar when viewing site' ); ?>
   369 								<?php _e( 'Show Toolbar when viewing site' ); ?>
   344 							</label><br />
   370 							</label><br />
   345 						</td>
   371 						</td>
   346 					</tr>
   372 					</tr>
   347 
   373 
   348 					<?php $languages = get_available_languages(); ?>
   374 					<?php
   349 					<?php if ( $languages ) : ?>
   375 					$languages                = get_available_languages();
       
   376 					$can_install_translations = current_user_can( 'install_languages' ) && wp_can_install_language_pack();
       
   377 					?>
       
   378 					<?php if ( $languages || $can_install_translations ) : ?>
   350 					<tr class="user-language-wrap">
   379 					<tr class="user-language-wrap">
   351 						<th scope="row">
   380 						<th scope="row">
   352 							<?php /* translators: The user language selection field label. */ ?>
   381 							<?php /* translators: The user language selection field label. */ ?>
   353 							<label for="locale"><?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label>
   382 							<label for="locale"><?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label>
   354 						</th>
   383 						</th>
   366 								array(
   395 								array(
   367 									'name'      => 'locale',
   396 									'name'      => 'locale',
   368 									'id'        => 'locale',
   397 									'id'        => 'locale',
   369 									'selected'  => $user_locale,
   398 									'selected'  => $user_locale,
   370 									'languages' => $languages,
   399 									'languages' => $languages,
   371 									'show_available_translations' => false,
   400 									'show_available_translations' => $can_install_translations,
   372 									'show_option_site_default' => true,
   401 									'show_option_site_default' => true,
   373 								)
   402 								)
   374 							);
   403 							);
   375 							?>
   404 							?>
   376 						</td>
   405 						</td>
   407 				<h2><?php _e( 'Name' ); ?></h2>
   436 				<h2><?php _e( 'Name' ); ?></h2>
   408 
   437 
   409 				<table class="form-table" role="presentation">
   438 				<table class="form-table" role="presentation">
   410 					<tr class="user-user-login-wrap">
   439 					<tr class="user-user-login-wrap">
   411 						<th><label for="user_login"><?php _e( 'Username' ); ?></label></th>
   440 						<th><label for="user_login"><?php _e( 'Username' ); ?></label></th>
   412 						<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profile_user->user_login ); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e( 'Usernames cannot be changed.' ); ?></span></td>
   441 						<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profile_user->user_login ); ?>" readonly="readonly" class="regular-text" /> <span class="description"><?php _e( 'Usernames cannot be changed.' ); ?></span></td>
   413 					</tr>
   442 					</tr>
   414 
   443 
   415 					<?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profile_user->ID ) ) : ?>
   444 					<?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profile_user->ID ) ) : ?>
   416 						<tr class="user-role-wrap">
   445 						<tr class="user-role-wrap">
   417 							<th><label for="role"><?php _e( 'Role' ); ?></label></th>
   446 							<th><label for="role"><?php _e( 'Role' ); ?></label></th>
   516 								<p class="description" id="email-description">
   545 								<p class="description" id="email-description">
   517 									<?php _e( 'If you change this, an email will be sent at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?>
   546 									<?php _e( 'If you change this, an email will be sent at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?>
   518 								</p>
   547 								</p>
   519 							<?php endif; ?>
   548 							<?php endif; ?>
   520 
   549 
   521 							<?php $new_email = get_user_meta( $current_user->ID, '_new_email', true ); ?>
   550 							<?php
   522 							<?php if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) : ?>
   551 							$new_email = get_user_meta( $current_user->ID, '_new_email', true );
   523 							<div class="updated inline">
   552 							if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) :
   524 								<p>
   553 
   525 									<?php
   554 								$pending_change_message = sprintf(
   526 									printf(
   555 									/* translators: %s: New email. */
   527 										/* translators: %s: New email. */
   556 									__( 'There is a pending change of your email to %s.' ),
   528 										__( 'There is a pending change of your email to %s.' ),
   557 									'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
   529 										'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
   558 								);
   530 									);
   559 								$pending_change_message .= sprintf(
   531 									printf(
   560 									' <a href="%1$s">%2$s</a>',
   532 										' <a href="%1$s">%2$s</a>',
   561 									esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
   533 										esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
   562 									__( 'Cancel' )
   534 										__( 'Cancel' )
   563 								);
   535 									);
   564 								wp_admin_notice(
   536 									?>
   565 									$pending_change_message,
   537 								</p>
   566 									array(
   538 							</div>
   567 										'additional_classes' => array( 'updated', 'inline' ),
   539 							<?php endif; ?>
   568 									)
       
   569 								);
       
   570 							endif;
       
   571 							?>
   540 						</td>
   572 						</td>
   541 					</tr>
   573 					</tr>
   542 
   574 
   543 					<tr class="user-url-wrap">
   575 					<tr class="user-url-wrap">
   544 						<th><label for="url"><?php _e( 'Website' ); ?></label></th>
   576 						<th><label for="url"><?php _e( 'Website' ); ?></label></th>
   632 
   664 
   633 						<table class="form-table" role="presentation">
   665 						<table class="form-table" role="presentation">
   634 							<tr id="password" class="user-pass1-wrap">
   666 							<tr id="password" class="user-pass1-wrap">
   635 								<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
   667 								<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
   636 								<td>
   668 								<td>
   637 									<input class="hidden" value=" " /><!-- #24364 workaround -->
   669 									<input type="hidden" value=" " /><!-- #24364 workaround -->
   638 									<button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="false"><?php _e( 'Set New Password' ); ?></button>
   670 									<button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="false"><?php _e( 'Set New Password' ); ?></button>
   639 									<div class="wp-pwd hide-if-js">
   671 									<div class="wp-pwd hide-if-js">
   640 										<span class="password-input-wrapper">
   672 										<div class="password-input-wrapper">
   641 											<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="new-password" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
   673 											<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="new-password" spellcheck="false" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
   642 										</span>
   674 											<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
       
   675 										</div>
   643 										<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
   676 										<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
   644 											<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
   677 											<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
   645 											<span class="text"><?php _e( 'Hide' ); ?></span>
   678 											<span class="text"><?php _e( 'Hide' ); ?></span>
   646 										</button>
   679 										</button>
   647 										<button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">
   680 										<button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">
   648 											<span class="dashicons dashicons-no" aria-hidden="true"></span>
   681 											<span class="dashicons dashicons-no" aria-hidden="true"></span>
   649 											<span class="text"><?php _e( 'Cancel' ); ?></span>
   682 											<span class="text"><?php _e( 'Cancel' ); ?></span>
   650 										</button>
   683 										</button>
   651 										<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
       
   652 									</div>
   684 									</div>
   653 								</td>
   685 								</td>
   654 							</tr>
   686 							</tr>
   655 							<tr class="user-pass2-wrap hide-if-js">
   687 							<tr class="user-pass2-wrap hide-if-js">
   656 								<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
   688 								<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
   657 								<td>
   689 								<td>
   658 								<input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="new-password" aria-describedby="pass2-desc" />
   690 								<input type="password" name="pass2" id="pass2" class="regular-text" value="" autocomplete="new-password" spellcheck="false" aria-describedby="pass2-desc" />
   659 									<?php if ( IS_PROFILE_PAGE ) : ?>
   691 									<?php if ( IS_PROFILE_PAGE ) : ?>
   660 										<p class="description" id="pass2-desc"><?php _e( 'Type your new password again.' ); ?></p>
   692 										<p class="description" id="pass2-desc"><?php _e( 'Type your new password again.' ); ?></p>
   661 									<?php else : ?>
   693 									<?php else : ?>
   662 										<p class="description" id="pass2-desc"><?php _e( 'Type the new password again.' ); ?></p>
   694 										<p class="description" id="pass2-desc"><?php _e( 'Type the new password again.' ); ?></p>
   663 									<?php endif; ?>
   695 									<?php endif; ?>
   673 								</td>
   705 								</td>
   674 							</tr>
   706 							</tr>
   675 							<?php endif; // End Show Password Fields. ?>
   707 							<?php endif; // End Show Password Fields. ?>
   676 
   708 
   677 							<?php // Allow admins to send reset password link. ?>
   709 							<?php // Allow admins to send reset password link. ?>
   678 							<?php if ( ! IS_PROFILE_PAGE ) : ?>
   710 							<?php if ( ! IS_PROFILE_PAGE && true === wp_is_password_reset_allowed_for_user( $profile_user ) ) : ?>
   679 								<tr class="user-generate-reset-link-wrap hide-if-no-js">
   711 								<tr class="user-generate-reset-link-wrap hide-if-no-js">
   680 									<th><?php _e( 'Password Reset' ); ?></th>
   712 									<th><?php _e( 'Password Reset' ); ?></th>
   681 									<td>
   713 									<td>
   682 										<div class="generate-reset-link">
   714 										<div class="generate-reset-link">
   683 											<button type="button" class="button button-secondary" id="generate-reset-link">
   715 											<button type="button" class="button button-secondary" id="generate-reset-link">
   777 
   809 
   778 								<?php if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) : ?>
   810 								<?php if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) : ?>
   779 									<div class="create-application-password form-wrap">
   811 									<div class="create-application-password form-wrap">
   780 										<div class="form-field">
   812 										<div class="form-field">
   781 											<label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label>
   813 											<label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label>
   782 											<input type="text" size="30" id="new_application_password_name" name="new_application_password_name" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
   814 											<input type="text" size="30" id="new_application_password_name" name="new_application_password_name" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" spellcheck="false" />
   783 											<p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
   815 											<p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
   784 										</div>
   816 										</div>
   785 
   817 
   786 										<?php
   818 										<?php
   787 										/**
   819 										/**
   794 										do_action( 'wp_create_application_password_form', $profile_user );
   826 										do_action( 'wp_create_application_password_form', $profile_user );
   795 										?>
   827 										?>
   796 
   828 
   797 										<button type="button" name="do_new_application_password" id="do_new_application_password" class="button button-secondary"><?php _e( 'Add New Application Password' ); ?></button>
   829 										<button type="button" name="do_new_application_password" id="do_new_application_password" class="button button-secondary"><?php _e( 'Add New Application Password' ); ?></button>
   798 									</div>
   830 									</div>
   799 								<?php else : ?>
   831 									<?php
   800 									<div class="notice notice-error inline">
   832 								else :
   801 										<p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p>
   833 									wp_admin_notice(
   802 									</div>
   834 										__( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ),
   803 								<?php endif; ?>
   835 										array(
       
   836 											'type' => 'error',
       
   837 											'additional_classes' => array( 'inline' ),
       
   838 										)
       
   839 									);
       
   840 								endif;
       
   841 								?>
   804 
   842 
   805 								<div class="application-passwords-list-table-wrapper">
   843 								<div class="application-passwords-list-table-wrapper">
   806 									<?php
   844 									<?php
   807 									$application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) );
   845 									$application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) );
   808 									$application_passwords_list_table->prepare_items();
   846 									$application_passwords_list_table->prepare_items();
   814 								<p>
   852 								<p>
   815 									<?php
   853 									<?php
   816 									printf(
   854 									printf(
   817 										/* translators: %s: Documentation URL. */
   855 										/* translators: %s: Documentation URL. */
   818 										__( 'If this is a development website you can <a href="%s" target="_blank">set the environment type accordingly</a> to enable application passwords.' ),
   856 										__( 'If this is a development website you can <a href="%s" target="_blank">set the environment type accordingly</a> to enable application passwords.' ),
   819 										__( 'https://wordpress.org/support/article/editing-wp-config-php/#wp_environment_type' )
   857 										__( 'https://developer.wordpress.org/apis/wp-config-php/#wp-environment-type' )
   820 									);
   858 									);
   821 									?>
   859 									?>
   822 								</p>
   860 								</p>
   823 							<?php endif; ?>
   861 							<?php endif; ?>
   824 						</div>
   862 						</div>
   909 	if (window.location.hash == '#password') {
   947 	if (window.location.hash == '#password') {
   910 		document.getElementById('pass1').focus();
   948 		document.getElementById('pass1').focus();
   911 	}
   949 	}
   912 </script>
   950 </script>
   913 
   951 
       
   952 <script type="text/javascript">
       
   953 	jQuery( function( $ ) {
       
   954 		var languageSelect = $( '#locale' );
       
   955 		$( 'form' ).on( 'submit', function() {
       
   956 			/*
       
   957 			 * Don't show a spinner for English and installed languages,
       
   958 			 * as there is nothing to download.
       
   959 			 */
       
   960 			if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
       
   961 				$( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' );
       
   962 			}
       
   963 		});
       
   964 	} );
       
   965 </script>
       
   966 
   914 <?php if ( isset( $application_passwords_list_table ) ) : ?>
   967 <?php if ( isset( $application_passwords_list_table ) ) : ?>
   915 	<script type="text/html" id="tmpl-new-application-password">
   968 	<script type="text/html" id="tmpl-new-application-password">
   916 		<div class="notice notice-success is-dismissible new-application-password-notice" role="alert" tabindex="-1">
   969 		<div class="notice notice-success is-dismissible new-application-password-notice" role="alert">
   917 			<p class="application-password-display">
   970 			<p class="application-password-display">
   918 				<label for="new-application-password-value">
   971 				<label for="new-application-password-value">
   919 					<?php
   972 					<?php
   920 					printf(
   973 					printf(
   921 						/* translators: %s: Application name. */
   974 						/* translators: %s: Application name. */
   926 				</label>
   979 				</label>
   927 				<input id="new-application-password-value" type="text" class="code" readonly="readonly" value="{{ data.password }}" />
   980 				<input id="new-application-password-value" type="text" class="code" readonly="readonly" value="{{ data.password }}" />
   928 			</p>
   981 			</p>
   929 			<p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p>
   982 			<p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p>
   930 			<button type="button" class="notice-dismiss">
   983 			<button type="button" class="notice-dismiss">
   931 				<span class="screen-reader-text"><?php _e( 'Dismiss this notice.' ); ?></span>
   984 				<span class="screen-reader-text">
       
   985 					<?php
       
   986 					/* translators: Hidden accessibility text. */
       
   987 					_e( 'Dismiss this notice.' );
       
   988 					?>
       
   989 				</span>
   932 			</button>
   990 			</button>
   933 		</div>
   991 		</div>
   934 	</script>
   992 	</script>
   935 
   993 
   936 	<script type="text/html" id="tmpl-application-password-row">
   994 	<script type="text/html" id="tmpl-application-password-row">