| 334 | | <tr class="show-admin-bar user-admin-bar-front-wrap"> |
| 335 | | <th scope="row"><?php _e( 'Toolbar' ); ?></th> |
| 336 | | <td> |
| 337 | | <label for="admin_bar_front"> |
| 338 | | <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> /> |
| 339 | | <?php _e( 'Show Toolbar when viewing site' ); ?> |
| 340 | | </label><br /> |
| 341 | | </td> |
| 342 | | </tr> |
| 343 | | |
| 344 | | <?php |
| 345 | | $languages = get_available_languages(); |
| 346 | | if ( $languages ) : |
| 347 | | ?> |
| 348 | | <tr class="user-language-wrap"> |
| 349 | | <th scope="row"> |
| 350 | | <?php /* translators: The user language selection field label. */ ?> |
| 351 | | <label for="locale"><?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label> |
| 352 | | </th> |
| 353 | | <td> |
| 354 | | <?php |
| 355 | | $user_locale = $profileuser->locale; |
| 356 | | |
| 357 | | if ( 'en_US' === $user_locale ) { |
| 358 | | $user_locale = ''; |
| 359 | | } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) { |
| 360 | | $user_locale = 'site-default'; |
| 361 | | } |
| 362 | | |
| 363 | | wp_dropdown_languages( |
| 364 | | array( |
| 365 | | 'name' => 'locale', |
| 366 | | 'id' => 'locale', |
| 367 | | 'selected' => $user_locale, |
| 368 | | 'languages' => $languages, |
| 369 | | 'show_available_translations' => false, |
| 370 | | 'show_option_site_default' => true, |
| 371 | | ) |
| 372 | | ); |
| 373 | | ?> |
| 374 | | </td> |
| 375 | | </tr> |
| 376 | | <?php |
| 377 | | endif; |
| 378 | | ?> |
| 379 | | |
| 380 | | <?php |
| 381 | | /** |
| 382 | | * Fires at the end of the 'Personal Options' settings table on the user editing screen. |
| 383 | | * |
| 384 | | * @since 2.7.0 |
| 385 | | * |
| 386 | | * @param WP_User $profileuser The current WP_User object. |
| 387 | | */ |
| 388 | | do_action( 'personal_options', $profileuser ); |
| 389 | | ?> |
| 390 | | |
| 391 | | </table> |
| 392 | | <?php |
| 393 | | if ( IS_PROFILE_PAGE ) { |
| 394 | | /** |
| 395 | | * Fires after the 'Personal Options' settings table on the 'Profile' editing screen. |
| 396 | | * |
| 397 | | * The action only fires if the current user is editing their own profile. |
| 398 | | * |
| 399 | | * @since 2.0.0 |
| 400 | | * |
| 401 | | * @param WP_User $profileuser The current WP_User object. |
| 402 | | */ |
| 403 | | do_action( 'profile_personal_options', $profileuser ); |
| 404 | | } |
| 405 | | ?> |
| 406 | | |
| 407 | | <h2><?php _e( 'Name' ); ?></h2> |
| 408 | | |
| 409 | | <table class="form-table" role="presentation"> |
| 410 | | <tr class="user-user-login-wrap"> |
| 411 | | <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( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e( 'Usernames cannot be changed.' ); ?></span></td> |
| 413 | | </tr> |
| 414 | | |
| 415 | | <?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profileuser->ID ) ) : ?> |
| 416 | | <tr class="user-role-wrap"><th><label for="role"><?php _e( 'Role' ); ?></label></th> |
| 417 | | <td><select name="role" id="role"> |
| 418 | | <?php |
| 419 | | // Compare user role against currently editable roles. |
| 420 | | $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) ); |
| 421 | | $user_role = reset( $user_roles ); |
| 422 | | |
| 423 | | // Print the full list of roles with the primary one selected. |
| 424 | | wp_dropdown_roles( $user_role ); |
| 425 | | |
| 426 | | // Print the 'no role' option. Make it selected if the user has no role yet. |
| 427 | | if ( $user_role ) { |
| 428 | | echo '<option value="">' . __( '— No role for this site —' ) . '</option>'; |
| 429 | | } else { |
| 430 | | echo '<option value="" selected="selected">' . __( '— No role for this site —' ) . '</option>'; |
| 431 | | } |
| 432 | | ?> |
| 433 | | </select></td></tr> |
| 434 | | <?php |
| 435 | | endif; // End if ! IS_PROFILE_PAGE. |
| 436 | | |
| 437 | | if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) ) { |
| 438 | | ?> |
| 439 | | <tr class="user-super-admin-wrap"><th><?php _e( 'Super Admin' ); ?></th> |
| 440 | | <td> |
| 441 | | <?php if ( 0 !== strcasecmp( $profileuser->user_email, get_site_option( 'admin_email' ) ) || ! is_super_admin( $profileuser->ID ) ) : ?> |
| 442 | | <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p> |
| 443 | | <?php else : ?> |
| 444 | | <p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p> |
| 445 | | <?php endif; ?> |
| 446 | | </td></tr> |
| 447 | | <?php } ?> |
| 448 | | |
| 449 | | <tr class="user-first-name-wrap"> |
| 450 | | <th><label for="first_name"><?php _e( 'First Name' ); ?></label></th> |
| 451 | | <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" /></td> |
| 452 | | </tr> |
| 453 | | |
| 454 | | <tr class="user-last-name-wrap"> |
| 455 | | <th><label for="last_name"><?php _e( 'Last Name' ); ?></label></th> |
| 456 | | <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" /></td> |
| 457 | | </tr> |
| 458 | | |
| 459 | | <tr class="user-nickname-wrap"> |
| 460 | | <th><label for="nickname"><?php _e( 'Nickname' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
| 461 | | <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" /></td> |
| 462 | | </tr> |
| 463 | | |
| 464 | | <tr class="user-display-name-wrap"> |
| 465 | | <th><label for="display_name"><?php _e( 'Display name publicly as' ); ?></label></th> |
| 466 | | <td> |
| 467 | | <select name="display_name" id="display_name"> |
| 468 | | <?php |
| 469 | | $public_display = array(); |
| 470 | | $public_display['display_nickname'] = $profileuser->nickname; |
| 471 | | $public_display['display_username'] = $profileuser->user_login; |
| 472 | | |
| 473 | | if ( ! empty( $profileuser->first_name ) ) { |
| 474 | | $public_display['display_firstname'] = $profileuser->first_name; |
| 475 | | } |
| 476 | | |
| 477 | | if ( ! empty( $profileuser->last_name ) ) { |
| 478 | | $public_display['display_lastname'] = $profileuser->last_name; |
| 479 | | } |
| 480 | | |
| 481 | | if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
| 482 | | $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
| 483 | | $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
| 484 | | } |
| 485 | | |
| 486 | | if ( ! in_array( $profileuser->display_name, $public_display, true ) ) { // Only add this if it isn't duplicated elsewhere. |
| 487 | | $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display; |
| 488 | | } |
| 489 | | |
| 490 | | $public_display = array_map( 'trim', $public_display ); |
| 491 | | $public_display = array_unique( $public_display ); |
| 492 | | |
| 493 | | foreach ( $public_display as $id => $item ) { |
| 494 | | ?> |
| 495 | | <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option> |
| 496 | | <?php |
| 497 | | } |
| 498 | | ?> |
| 499 | | </select> |
| 500 | | </td> |
| 501 | | </tr> |
| 502 | | </table> |
| 503 | | |
| 504 | | <h2><?php _e( 'Contact Info' ); ?></h2> |
| 505 | | |
| 506 | | <table class="form-table" role="presentation"> |
| 507 | | <tr class="user-email-wrap"> |
| 508 | | <th><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
| 509 | | <td><input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text ltr" /> |
| 510 | | <?php |
| 511 | | if ( $profileuser->ID == $current_user->ID ) : |
| 512 | | ?> |
| 513 | | <p class="description" id="email-description"> |
| 514 | | <?php _e( 'If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?> |
| 515 | | </p> |
| 516 | | <?php |
| 517 | | endif; |
| 518 | | |
| 519 | | $new_email = get_user_meta( $current_user->ID, '_new_email', true ); |
| 520 | | if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : |
| 521 | | ?> |
| 522 | | <div class="updated inline"> |
| 523 | | <p> |
| 524 | | <?php |
| 525 | | printf( |
| 526 | | /* translators: %s: New email. */ |
| 527 | | __( 'There is a pending change of your email to %s.' ), |
| 528 | | '<code>' . esc_html( $new_email['newemail'] ) . '</code>' |
| 529 | | ); |
| 530 | | printf( |
| 531 | | ' <a href="%1$s">%2$s</a>', |
| 532 | | esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ), |
| 533 | | __( 'Cancel' ) |
| 534 | | ); |
| 535 | | ?> |
| 536 | | </p> |
| 537 | | </div> |
| | 221 | <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?> |
| | 222 | <div class="error"> |
| | 223 | <p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p> |
| | 224 | </div> |
| 765 | | if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) { |
| 766 | | ?> |
| 767 | | <div class="create-application-password form-wrap"> |
| 768 | | <div class="form-field"> |
| 769 | | <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label> |
| 770 | | <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" /> |
| 771 | | <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p> |
| 772 | | </div> |
| | 288 | <?php if ( $show_syntax_highlighting_preference ) : ?> |
| | 289 | <tr class="user-syntax-highlighting-wrap"> |
| | 290 | <th scope="row"><?php _e( 'Syntax Highlighting' ); ?></th> |
| | 291 | <td> |
| | 292 | <label for="syntax_highlighting"><input name="syntax_highlighting" type="checkbox" id="syntax_highlighting" value="false" <?php checked( 'false', $profileuser->syntax_highlighting ); ?> /> |
| | 293 | <?php _e( 'Disable syntax highlighting when editing code' ); ?> |
| | 294 | </label> |
| | 295 | </td> |
| | 296 | </tr> |
| | 297 | <?php endif; ?> |
| | 298 | |
| | 299 | <?php if ( count( $_wp_admin_css_colors ) > 1 && has_action( 'admin_color_scheme_picker' ) ) : ?> |
| | 300 | <tr class="user-admin-color-wrap"> |
| | 301 | <th scope="row"><?php _e( 'Admin Color Scheme' ); ?></th> |
| | 302 | <td> |
| | 303 | <?php |
| | 304 | /** |
| | 305 | * Fires in the 'Admin Color Scheme' section of the user editing screen. |
| | 306 | * |
| | 307 | * The section is only enabled if a callback is hooked to the action, |
| | 308 | * and if there is more than one defined color scheme for the admin. |
| | 309 | * |
| | 310 | * @since 3.0.0 |
| | 311 | * @since 3.8.1 Added `$user_id` parameter. |
| | 312 | * |
| | 313 | * @param int $user_id The user ID. |
| | 314 | */ |
| | 315 | do_action( 'admin_color_scheme_picker', $user_id ); |
| | 316 | ?> |
| | 317 | </td> |
| | 318 | </tr> |
| | 319 | <?php endif; // End if count ( $_wp_admin_css_colors ) > 1 ?> |
| | 320 | |
| | 321 | <?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?> |
| | 322 | <tr class="user-comment-shortcuts-wrap"> |
| | 323 | <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th> |
| | 324 | <td> |
| | 325 | <label for="comment_shortcuts"> |
| | 326 | <input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( 'true', $profileuser->comment_shortcuts ); ?> /> |
| | 327 | <?php _e( 'Enable keyboard shortcuts for comment moderation.' ); ?> |
| | 328 | </label> |
| | 329 | <?php _e( '<a href="https://wordpress.org/support/article/keyboard-shortcuts/" target="_blank">More information</a>' ); ?> |
| | 330 | </td> |
| | 331 | </tr> |
| | 332 | <?php endif; ?> |
| | 333 | |
| | 334 | <tr class="show-admin-bar user-admin-bar-front-wrap"> |
| | 335 | <th scope="row"><?php _e( 'Toolbar' ); ?></th> |
| | 336 | <td> |
| | 337 | <label for="admin_bar_front"> |
| | 338 | <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> /> |
| | 339 | <?php _e( 'Show Toolbar when viewing site' ); ?> |
| | 340 | </label><br /> |
| | 341 | </td> |
| | 342 | </tr> |
| | 343 | |
| | 344 | <?php $languages = get_available_languages(); ?> |
| | 345 | <?php if ( $languages ) : ?> |
| | 346 | <tr class="user-language-wrap"> |
| | 347 | <th scope="row"> |
| | 348 | <?php /* translators: The user language selection field label. */ ?> |
| | 349 | <label for="locale"><?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label> |
| | 350 | </th> |
| | 351 | <td> |
| | 352 | <?php |
| | 353 | $user_locale = $profileuser->locale; |
| | 354 | |
| | 355 | if ( 'en_US' === $user_locale ) { |
| | 356 | $user_locale = ''; |
| | 357 | } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) { |
| | 358 | $user_locale = 'site-default'; |
| | 359 | } |
| | 360 | |
| | 361 | // phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned |
| | 362 | // phpcs:disable WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow |
| | 363 | wp_dropdown_languages( |
| | 364 | array( |
| | 365 | 'name' => 'locale', |
| | 366 | 'id' => 'locale', |
| | 367 | 'selected' => $user_locale, |
| | 368 | 'languages' => $languages, |
| | 369 | 'show_available_translations' => false, |
| | 370 | 'show_option_site_default' => true, |
| | 371 | ) |
| | 372 | ); |
| | 373 | // phpcs:enable |
| | 374 | ?> |
| | 375 | </td> |
| | 376 | </tr> |
| | 377 | <?php endif; ?> |
| 839 | | <?php |
| 840 | | /** |
| 841 | | * Filters whether to display additional capabilities for the user. |
| 842 | | * |
| 843 | | * The 'Additional Capabilities' section will only be enabled if |
| 844 | | * the number of the user's capabilities exceeds their number of |
| 845 | | * roles. |
| 846 | | * |
| 847 | | * @since 2.8.0 |
| 848 | | * |
| 849 | | * @param bool $enable Whether to display the capabilities. Default true. |
| 850 | | * @param WP_User $profileuser The current WP_User object. |
| 851 | | */ |
| 852 | | if ( count( $profileuser->caps ) > count( $profileuser->roles ) |
| 853 | | && apply_filters( 'additional_capabilities_display', true, $profileuser ) |
| 854 | | ) : |
| 855 | | ?> |
| 856 | | <h2><?php _e( 'Additional Capabilities' ); ?></h2> |
| 857 | | <table class="form-table" role="presentation"> |
| 858 | | <tr class="user-capabilities-wrap"> |
| 859 | | <th scope="row"><?php _e( 'Capabilities' ); ?></th> |
| 860 | | <td> |
| 861 | | <?php |
| 862 | | $output = ''; |
| 863 | | foreach ( $profileuser->caps as $cap => $value ) { |
| 864 | | if ( ! $wp_roles->is_role( $cap ) ) { |
| 865 | | if ( '' != $output ) { |
| 866 | | $output .= ', '; |
| 867 | | } |
| | 406 | <h2><?php _e( 'Name' ); ?></h2> |
| | 407 | |
| | 408 | <table class="form-table" role="presentation"> |
| | 409 | <tr class="user-user-login-wrap"> |
| | 410 | <th><label for="user_login"><?php _e( 'Username' ); ?></label></th> |
| | 411 | <td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e( 'Usernames cannot be changed.' ); ?></span></td> |
| | 412 | </tr> |
| | 413 | |
| | 414 | <?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profileuser->ID ) ) : ?> |
| | 415 | <tr class="user-role-wrap"> |
| | 416 | <th><label for="role"><?php _e( 'Role' ); ?></label></th> |
| | 417 | <td> |
| | 418 | <select name="role" id="role"> |
| | 419 | <?php |
| | 420 | // Compare user role against currently editable roles. |
| | 421 | $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) ); |
| | 422 | $user_role = reset( $user_roles ); |
| | 423 | |
| | 424 | // Print the full list of roles with the primary one selected. |
| | 425 | wp_dropdown_roles( $user_role ); |
| | 426 | |
| | 427 | // Print the 'no role' option. Make it selected if the user has no role yet. |
| | 428 | if ( $user_role ) { |
| | 429 | echo '<option value="">' . __( '— No role for this site —' ) . '</option>'; |
| | 430 | } else { |
| | 431 | echo '<option value="" selected="selected">' . __( '— No role for this site —' ) . '</option>'; |
| | 432 | } |
| | 433 | ?> |
| | 434 | </select> |
| | 435 | </td> |
| | 436 | </tr> |
| | 437 | <?php endif; // End if ! IS_PROFILE_PAGE. ?> |
| | 438 | |
| | 439 | <?php if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) ) : ?> |
| | 440 | <tr class="user-super-admin-wrap"> |
| | 441 | <th><?php _e( 'Super Admin' ); ?></th> |
| | 442 | <td> |
| | 443 | <?php if ( 0 !== strcasecmp( $profileuser->user_email, get_site_option( 'admin_email' ) ) || ! is_super_admin( $profileuser->ID ) ) : ?> |
| | 444 | <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p> |
| | 445 | <?php else : ?> |
| | 446 | <p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p> |
| | 447 | <?php endif; ?> |
| | 448 | </td> |
| | 449 | </tr> |
| | 450 | <?php endif; ?> |
| | 451 | |
| | 452 | <tr class="user-first-name-wrap"> |
| | 453 | <th><label for="first_name"><?php _e( 'First Name' ); ?></label></th> |
| | 454 | <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" /></td> |
| | 455 | </tr> |
| | 456 | |
| | 457 | <tr class="user-last-name-wrap"> |
| | 458 | <th><label for="last_name"><?php _e( 'Last Name' ); ?></label></th> |
| | 459 | <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" /></td> |
| | 460 | </tr> |
| | 461 | |
| | 462 | <tr class="user-nickname-wrap"> |
| | 463 | <th><label for="nickname"><?php _e( 'Nickname' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
| | 464 | <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" /></td> |
| | 465 | </tr> |
| | 466 | |
| | 467 | <tr class="user-display-name-wrap"> |
| | 468 | <th> |
| | 469 | <label for="display_name"><?php _e( 'Display name publicly as' ); ?></label> |
| | 470 | </th> |
| | 471 | <td> |
| | 472 | <select name="display_name" id="display_name"> |
| | 473 | <?php |
| | 474 | $public_display = array(); |
| | 475 | $public_display['display_nickname'] = $profileuser->nickname; |
| | 476 | $public_display['display_username'] = $profileuser->user_login; |
| | 477 | |
| | 478 | if ( ! empty( $profileuser->first_name ) ) { |
| | 479 | $public_display['display_firstname'] = $profileuser->first_name; |
| | 480 | } |
| | 481 | |
| | 482 | if ( ! empty( $profileuser->last_name ) ) { |
| | 483 | $public_display['display_lastname'] = $profileuser->last_name; |
| | 484 | } |
| | 485 | |
| | 486 | if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
| | 487 | $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
| | 488 | $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
| | 489 | } |
| | 490 | |
| | 491 | if ( ! in_array( $profileuser->display_name, $public_display, true ) ) { // Only add this if it isn't duplicated elsewhere. |
| | 492 | $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display; |
| | 493 | } |
| | 494 | |
| | 495 | $public_display = array_map( 'trim', $public_display ); |
| | 496 | $public_display = array_unique( $public_display ); |
| | 497 | |
| | 498 | ?> |
| | 499 | <?php foreach ( $public_display as $id => $item ) : ?> |
| | 500 | <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option> |
| | 501 | <?php endforeach; ?> |
| | 502 | </select> |
| | 503 | </td> |
| | 504 | </tr> |
| | 505 | </table> |
| | 506 | |
| | 507 | <h2><?php _e( 'Contact Info' ); ?></h2> |
| | 508 | |
| | 509 | <table class="form-table" role="presentation"> |
| | 510 | <tr class="user-email-wrap"> |
| | 511 | <th><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
| | 512 | <td> |
| | 513 | <input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text ltr" /> |
| | 514 | <?php if ( $profileuser->ID == $current_user->ID ) : ?> |
| | 515 | <p class="description" id="email-description"> |
| | 516 | <?php _e( 'If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?> |
| | 517 | </p> |
| | 518 | <?php endif; ?> |
| | 519 | |
| | 520 | <?php $new_email = get_user_meta( $current_user->ID, '_new_email', true ); ?> |
| | 521 | <?php if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?> |
| | 522 | <div class="updated inline"> |
| | 523 | <p> |
| | 524 | <?php |
| | 525 | printf( |
| | 526 | /* translators: %s: New email. */ |
| | 527 | __( 'There is a pending change of your email to %s.' ), |
| | 528 | '<code>' . esc_html( $new_email['newemail'] ) . '</code>' |
| | 529 | ); |
| | 530 | printf( |
| | 531 | ' <a href="%1$s">%2$s</a>', |
| | 532 | esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ), |
| | 533 | __( 'Cancel' ) |
| | 534 | ); |
| | 535 | ?> |
| | 536 | </p> |
| | 537 | </div> |
| | 538 | <?php endif; ?> |
| | 539 | </td> |
| | 540 | </tr> |
| | 541 | |
| | 542 | <tr class="user-url-wrap"> |
| | 543 | <th><label for="url"><?php _e( 'Website' ); ?></label></th> |
| | 544 | <td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ); ?>" class="regular-text code" /></td> |
| | 545 | </tr> |
| | 546 | |
| | 547 | <?php foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) : ?> |
| | 548 | <tr class="user-<?php echo $name; ?>-wrap"> |
| | 549 | <th> |
| | 550 | <label for="<?php echo $name; ?>"> |
| | 551 | <?php |
| | 552 | /** |
| | 553 | * Filters a user contactmethod label. |
| | 554 | * |
| | 555 | * The dynamic portion of the hook name, `$name`, refers to |
| | 556 | * each of the keys in the contact methods array. |
| | 557 | * |
| | 558 | * @since 2.9.0 |
| | 559 | * |
| | 560 | * @param string $desc The translatable label for the contact method. |
| | 561 | */ |
| | 562 | echo apply_filters( "user_{$name}_label", $desc ); |
| | 563 | ?> |
| | 564 | </label> |
| | 565 | </th> |
| | 566 | <td> |
| | 567 | <input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ); ?>" class="regular-text" /> |
| | 568 | </td> |
| | 569 | </tr> |
| | 570 | <?php endforeach; ?> |
| | 571 | </table> |
| | 572 | |
| | 573 | <h2><?php IS_PROFILE_PAGE ? _e( 'About Yourself' ) : _e( 'About the user' ); ?></h2> |
| | 574 | |
| | 575 | <table class="form-table" role="presentation"> |
| | 576 | <tr class="user-description-wrap"> |
| | 577 | <th><label for="description"><?php _e( 'Biographical Info' ); ?></label></th> |
| | 578 | <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea> |
| | 579 | <p class="description"><?php _e( 'Share a little biographical information to fill out your profile. This may be shown publicly.' ); ?></p></td> |
| | 580 | </tr> |
| | 581 | |
| | 582 | <?php if ( get_option( 'show_avatars' ) ) : ?> |
| | 583 | <tr class="user-profile-picture"> |
| | 584 | <th><?php _e( 'Profile Picture' ); ?></th> |
| | 585 | <td> |
| | 586 | <?php echo get_avatar( $user_id ); ?> |
| | 587 | <p class="description"> |
| | 588 | <?php |
| | 589 | if ( IS_PROFILE_PAGE ) { |
| | 590 | $description = sprintf( |
| | 591 | /* translators: %s: Gravatar URL. */ |
| | 592 | __( '<a href="%s">You can change your profile picture on Gravatar</a>.' ), |
| | 593 | __( 'https://en.gravatar.com/' ) |
| | 594 | ); |
| | 595 | } else { |
| | 596 | $description = ''; |
| | 597 | } |
| | 598 | |
| | 599 | /** |
| | 600 | * Filters the user profile picture description displayed under the Gravatar. |
| | 601 | * |
| | 602 | * @since 4.4.0 |
| | 603 | * @since 4.7.0 Added the `$profileuser` parameter. |
| | 604 | * |
| | 605 | * @param string $description The description that will be printed. |
| | 606 | * @param WP_User $profileuser The current WP_User object. |
| | 607 | */ |
| | 608 | echo apply_filters( 'user_profile_picture_description', $description, $profileuser ); |
| | 609 | ?> |
| | 610 | </p> |
| | 611 | </td> |
| | 612 | </tr> |
| | 613 | <?php endif; ?> |
| | 614 | <?php |
| | 615 | /** |
| | 616 | * Filters the display of the password fields. |
| | 617 | * |
| | 618 | * @since 1.5.1 |
| | 619 | * @since 2.8.0 Added the `$profileuser` parameter. |
| | 620 | * @since 4.4.0 Now evaluated only in user-edit.php. |
| | 621 | * |
| | 622 | * @param bool $show Whether to show the password fields. Default true. |
| | 623 | * @param WP_User $profileuser User object for the current user to edit. |
| | 624 | */ |
| | 625 | $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ); |
| | 626 | ?> |
| | 627 | <?php if ( $show_password_fields ) : ?> |
| | 628 | </table> |
| | 629 | |
| | 630 | <h2><?php _e( 'Account Management' ); ?></h2> |
| | 631 | |
| | 632 | <table class="form-table" role="presentation"> |
| | 633 | <tr id="password" class="user-pass1-wrap"> |
| | 634 | <th><label for="pass1"><?php _e( 'New Password' ); ?></label></th> |
| | 635 | <td> |
| | 636 | <input class="hidden" value=" " /><!-- #24364 workaround --> |
| | 637 | <button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="false"><?php _e( 'Set New Password' ); ?></button> |
| | 638 | <div class="wp-pwd hide-if-js"> |
| | 639 | <span class="password-input-wrapper"> |
| | 640 | <input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" /> |
| | 641 | </span> |
| | 642 | <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
| | 643 | <span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
| | 644 | <span class="text"><?php _e( 'Hide' ); ?></span> |
| | 645 | </button> |
| | 646 | <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>"> |
| | 647 | <span class="dashicons dashicons-no" aria-hidden="true"></span> |
| | 648 | <span class="text"><?php _e( 'Cancel' ); ?></span> |
| | 649 | </button> |
| | 650 | <div style="display:none" id="pass-strength-result" aria-live="polite"></div> |
| | 651 | </div> |
| | 652 | </td> |
| | 653 | </tr> |
| | 654 | <tr class="user-pass2-wrap hide-if-js"> |
| | 655 | <th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th> |
| | 656 | <td> |
| | 657 | <input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" aria-describedby="pass2-desc" /> |
| | 658 | <?php if ( IS_PROFILE_PAGE ) : ?> |
| | 659 | <p class="description" id="pass2-desc"><?php _e( 'Type your new password again.' ); ?></p> |
| | 660 | <?php else : ?> |
| | 661 | <p class="description" id="pass2-desc"><?php _e( 'Type the new password again.' ); ?></p> |
| | 662 | <?php endif; ?> |
| | 663 | </td> |
| | 664 | </tr> |
| | 665 | <tr class="pw-weak"> |
| | 666 | <th><?php _e( 'Confirm Password' ); ?></th> |
| | 667 | <td> |
| | 668 | <label> |
| | 669 | <input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
| | 670 | <span id="pw-weak-text-label"><?php _e( 'Confirm use of weak password' ); ?></span> |
| | 671 | </label> |
| | 672 | </td> |
| | 673 | </tr> |
| | 674 | <?php endif; // End Show Password Fields. ?> |
| | 675 | |
| | 676 | <?php // Allow admins to send reset password link. ?> |
| | 677 | <?php if ( ! IS_PROFILE_PAGE ) : ?> |
| | 678 | <tr class="user-generate-reset-link-wrap hide-if-no-js"> |
| | 679 | <th><?php _e( 'Password Reset' ); ?></th> |
| | 680 | <td> |
| | 681 | <div class="generate-reset-link"> |
| | 682 | <button type="button" class="button button-secondary" id="generate-reset-link"> |
| | 683 | <?php _e( 'Send Reset Link' ); ?> |
| | 684 | </button> |
| | 685 | </div> |
| | 686 | <p class="description"> |
| | 687 | <?php |
| | 688 | /* translators: %s: User's display name. */ |
| | 689 | printf( __( 'Send %s a link to reset their password. This will not change their password, nor will it force a change.' ), esc_html( $profileuser->display_name ) ); |
| | 690 | ?> |
| | 691 | </p> |
| | 692 | </td> |
| | 693 | </tr> |
| | 694 | <?php endif; ?> |
| | 695 | |
| | 696 | <?php if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) : ?> |
| | 697 | <tr class="user-sessions-wrap hide-if-no-js"> |
| | 698 | <th><?php _e( 'Sessions' ); ?></th> |
| | 699 | <td aria-live="assertive"> |
| | 700 | <div class="destroy-sessions"><button type="button" disabled class="button"><?php _e( 'Log Out Everywhere Else' ); ?></button></div> |
| | 701 | <p class="description"> |
| | 702 | <?php _e( 'You are only logged in at this location.' ); ?> |
| | 703 | </p> |
| | 704 | </td> |
| | 705 | </tr> |
| | 706 | <?php elseif ( IS_PROFILE_PAGE && count( $sessions->get_all() ) > 1 ) : ?> |
| | 707 | <tr class="user-sessions-wrap hide-if-no-js"> |
| | 708 | <th><?php _e( 'Sessions' ); ?></th> |
| | 709 | <td aria-live="assertive"> |
| | 710 | <div class="destroy-sessions"><button type="button" class="button" id="destroy-sessions"><?php _e( 'Log Out Everywhere Else' ); ?></button></div> |
| | 711 | <p class="description"> |
| | 712 | <?php _e( 'Did you lose your phone or leave your account logged in at a public computer? You can log out everywhere else, and stay logged in here.' ); ?> |
| | 713 | </p> |
| | 714 | </td> |
| | 715 | </tr> |
| | 716 | <?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all() ) : ?> |
| | 717 | <tr class="user-sessions-wrap hide-if-no-js"> |
| | 718 | <th><?php _e( 'Sessions' ); ?></th> |
| | 719 | <td> |
| | 720 | <p><button type="button" class="button" id="destroy-sessions"><?php _e( 'Log Out Everywhere' ); ?></button></p> |
| | 721 | <p class="description"> |
| | 722 | <?php |
| | 723 | /* translators: %s: User's display name. */ |
| | 724 | printf( __( 'Log %s out of all locations.' ), $profileuser->display_name ); |
| | 725 | ?> |
| | 726 | </p> |
| | 727 | </td> |
| | 728 | </tr> |
| | 729 | <?php endif; ?> |
| | 730 | </table> |
| | 731 | |
| | 732 | <?php if ( wp_is_application_passwords_available_for_user( $user_id ) || ! wp_is_application_passwords_supported() ) : ?> |
| | 733 | <div class="application-passwords hide-if-no-js" id="application-passwords-section"> |
| | 734 | <h2><?php _e( 'Application Passwords' ); ?></h2> |
| | 735 | <p><?php _e( 'Application passwords allow authentication via non-interactive systems, such as XML-RPC or the REST API, without providing your actual password. Application passwords can be easily revoked. They cannot be used for traditional logins to your website.' ); ?></p> |
| | 736 | <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?> |
| | 737 | <?php |
| | 738 | if ( is_multisite() ) : |
| | 739 | $blogs = get_blogs_of_user( $user_id, true ); |
| | 740 | $blogs_count = count( $blogs ); |
| | 741 | if ( $blogs_count > 1 ) : |
| | 742 | ?> |
| | 743 | <p> |
| | 744 | <?php |
| | 745 | printf( |
| | 746 | /* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */ |
| | 747 | _n( |
| | 748 | 'Application passwords grant access to <a href="%1$s">the %2$s site in this installation that you have permissions on</a>.', |
| | 749 | 'Application passwords grant access to <a href="%1$s">all %2$s sites in this installation that you have permissions on</a>.', |
| | 750 | $blogs_count |
| | 751 | ), |
| | 752 | admin_url( 'my-sites.php' ), |
| | 753 | number_format_i18n( $blogs_count ) |
| | 754 | ); |
| | 755 | ?> |
| | 756 | </p> |
| | 757 | <?php |
| | 758 | endif; |
| | 759 | endif; |
| | 760 | ?> |
| | 761 | |
| | 762 | <?php if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) : ?> |
| | 763 | <div class="create-application-password form-wrap"> |
| | 764 | <div class="form-field"> |
| | 765 | <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label> |
| | 766 | <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" /> |
| | 767 | <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p> |
| | 768 | </div> |
| | 769 | |
| | 770 | <?php |
| | 771 | /** |
| | 772 | * Fires in the create Application Passwords form. |
| | 773 | * |
| | 774 | * @since 5.6.0 |
| | 775 | * |
| | 776 | * @param WP_User $profileuser The current WP_User object. |
| | 777 | */ |
| | 778 | do_action( 'wp_create_application_password_form', $profileuser ); |
| | 779 | ?> |
| | 780 | |
| | 781 | <button type="button" name="do_new_application_password" id="do_new_application_password" class="button button-secondary"><?php _e( 'Add New Application Password' ); ?></button> |
| | 782 | </div> |
| | 783 | <?php else : ?> |
| | 784 | <div class="notice notice-error inline"> |
| | 785 | <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p> |
| | 786 | </div> |
| | 787 | <?php endif; ?> |
| | 788 | |
| | 789 | <div class="application-passwords-list-table-wrapper"> |
| | 790 | <?php |
| | 791 | $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) ); |
| | 792 | $application_passwords_list_table->prepare_items(); |
| | 793 | $application_passwords_list_table->display(); |
| | 794 | ?> |
| | 795 | </div> |
| | 796 | <?php elseif ( ! wp_is_application_passwords_supported() ) : ?> |
| | 797 | <p><?php _e( 'The application password feature requires HTTPS, which is not enabled on this site.' ); ?></p> |
| | 798 | <p> |
| | 799 | <?php |
| | 800 | printf( |
| | 801 | /* translators: %s: Documentation URL. */ |
| | 802 | __( 'If this is a development website you can <a href="%s" target="_blank">set the environment type accordingly</a> to enable application passwords.' ), |
| | 803 | __( 'https://wordpress.org/support/article/editing-wp-config-php/#wp_environment_type' ) |
| | 804 | ); |
| | 805 | ?> |
| | 806 | </p> |
| | 807 | <?php endif; ?> |
| | 808 | </div> |
| | 809 | <?php endif; // End Application Passwords. ?> |