Changeset 52689
- Timestamp:
- 02/07/2022 03:24:27 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/user-edit.php
r52687 r52689 186 186 // Intentional fall-through to display $errors. 187 187 default: 188 $profile user = get_user_to_edit( $user_id );188 $profile_user = get_user_to_edit( $user_id ); 189 189 190 190 if ( ! current_user_can( 'edit_user', $user_id ) ) { … … 192 192 } 193 193 194 $title = sprintf( $title, $profile user->display_name );195 $sessions = WP_Session_Tokens::get_instance( $profile user->ID );194 $title = sprintf( $title, $profile_user->display_name ); 195 $sessions = WP_Session_Tokens::get_instance( $profile_user->ID ); 196 196 197 197 require_once ABSPATH . 'wp-admin/admin-header.php'; 198 198 ?> 199 199 200 <?php if ( ! IS_PROFILE_PAGE && is_super_admin( $profile user->ID ) && current_user_can( 'manage_network_options' ) ) { ?>200 <?php if ( ! IS_PROFILE_PAGE && is_super_admin( $profile_user->ID ) && current_user_can( 'manage_network_options' ) ) { ?> 201 201 <div class="notice notice-info"><p><strong><?php _e( 'Important:' ); ?></strong> <?php _e( 'This user has super admin privileges.' ); ?></p></div> 202 202 <?php } ?> … … 271 271 <th scope="row"><?php _e( 'Visual Editor' ); ?></th> 272 272 <td> 273 <label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked( 'false', $profile user->rich_editing ); ?> />273 <label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked( 'false', $profile_user->rich_editing ); ?> /> 274 274 <?php _e( 'Disable the visual editor when writing' ); ?> 275 275 </label> … … 280 280 $show_syntax_highlighting_preference = ( 281 281 // For Custom HTML widget and Additional CSS in Customizer. 282 user_can( $profile user, 'edit_theme_options' )282 user_can( $profile_user, 'edit_theme_options' ) 283 283 || 284 284 // Edit plugins. 285 user_can( $profile user, 'edit_plugins' )285 user_can( $profile_user, 'edit_plugins' ) 286 286 || 287 287 // Edit themes. 288 user_can( $profile user, 'edit_themes' )288 user_can( $profile_user, 'edit_themes' ) 289 289 ); 290 290 ?> … … 294 294 <th scope="row"><?php _e( 'Syntax Highlighting' ); ?></th> 295 295 <td> 296 <label for="syntax_highlighting"><input name="syntax_highlighting" type="checkbox" id="syntax_highlighting" value="false" <?php checked( 'false', $profile user->syntax_highlighting ); ?> />296 <label for="syntax_highlighting"><input name="syntax_highlighting" type="checkbox" id="syntax_highlighting" value="false" <?php checked( 'false', $profile_user->syntax_highlighting ); ?> /> 297 297 <?php _e( 'Disable syntax highlighting when editing code' ); ?> 298 298 </label> … … 328 328 <td> 329 329 <label for="comment_shortcuts"> 330 <input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( 'true', $profile user->comment_shortcuts ); ?> />330 <input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( 'true', $profile_user->comment_shortcuts ); ?> /> 331 331 <?php _e( 'Enable keyboard shortcuts for comment moderation.' ); ?> 332 332 </label> … … 340 340 <td> 341 341 <label for="admin_bar_front"> 342 <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profile user->ID ) ); ?> />342 <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profile_user->ID ) ); ?> /> 343 343 <?php _e( 'Show Toolbar when viewing site' ); ?> 344 344 </label><br /> … … 357 357 <td> 358 358 <?php 359 $user_locale = $profile user->locale;359 $user_locale = $profile_user->locale; 360 360 361 361 if ( 'en_US' === $user_locale ) { … … 388 388 * @since 2.7.0 389 389 * 390 * @param WP_User $profile user The current WP_User object.390 * @param WP_User $profile_user The current WP_User object. 391 391 */ 392 do_action( 'personal_options', $profile user );392 do_action( 'personal_options', $profile_user ); 393 393 ?> 394 394 … … 403 403 * @since 2.0.0 404 404 * 405 * @param WP_User $profile user The current WP_User object.405 * @param WP_User $profile_user The current WP_User object. 406 406 */ 407 do_action( 'profile_personal_options', $profile user );407 do_action( 'profile_personal_options', $profile_user ); 408 408 } 409 409 ?> … … 414 414 <tr class="user-user-login-wrap"> 415 415 <th><label for="user_login"><?php _e( 'Username' ); ?></label></th> 416 <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>417 </tr> 418 419 <?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profile user->ID ) ) : ?>416 <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> 417 </tr> 418 419 <?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profile_user->ID ) ) : ?> 420 420 <tr class="user-role-wrap"><th><label for="role"><?php _e( 'Role' ); ?></label></th> 421 421 <td><select name="role" id="role"> 422 422 <?php 423 423 // Compare user role against currently editable roles. 424 $user_roles = array_intersect( array_values( $profile user->roles ), array_keys( get_editable_roles() ) );424 $user_roles = array_intersect( array_values( $profile_user->roles ), array_keys( get_editable_roles() ) ); 425 425 $user_role = reset( $user_roles ); 426 426 … … 443 443 <tr class="user-super-admin-wrap"><th><?php _e( 'Super Admin' ); ?></th> 444 444 <td> 445 <?php if ( 0 !== strcasecmp( $profile user->user_email, get_site_option( 'admin_email' ) ) || ! is_super_admin( $profileuser->ID ) ) : ?>446 <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profile user->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>445 <?php if ( 0 !== strcasecmp( $profile_user->user_email, get_site_option( 'admin_email' ) ) || ! is_super_admin( $profile_user->ID ) ) : ?> 446 <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profile_user->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p> 447 447 <?php else : ?> 448 448 <p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p> … … 453 453 <tr class="user-first-name-wrap"> 454 454 <th><label for="first_name"><?php _e( 'First Name' ); ?></label></th> 455 <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profile user->first_name ); ?>" class="regular-text" /></td>455 <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profile_user->first_name ); ?>" class="regular-text" /></td> 456 456 </tr> 457 457 458 458 <tr class="user-last-name-wrap"> 459 459 <th><label for="last_name"><?php _e( 'Last Name' ); ?></label></th> 460 <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profile user->last_name ); ?>" class="regular-text" /></td>460 <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profile_user->last_name ); ?>" class="regular-text" /></td> 461 461 </tr> 462 462 463 463 <tr class="user-nickname-wrap"> 464 464 <th><label for="nickname"><?php _e( 'Nickname' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> 465 <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profile user->nickname ); ?>" class="regular-text" /></td>465 <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profile_user->nickname ); ?>" class="regular-text" /></td> 466 466 </tr> 467 467 … … 472 472 <?php 473 473 $public_display = array(); 474 $public_display['display_nickname'] = $profile user->nickname;475 $public_display['display_username'] = $profile user->user_login;476 477 if ( ! empty( $profile user->first_name ) ) {478 $public_display['display_firstname'] = $profile user->first_name;479 } 480 481 if ( ! empty( $profile user->last_name ) ) {482 $public_display['display_lastname'] = $profile user->last_name;483 } 484 485 if ( ! empty( $profile user->first_name ) && ! empty( $profileuser->last_name ) ) {486 $public_display['display_firstlast'] = $profile user->first_name . ' ' . $profileuser->last_name;487 $public_display['display_lastfirst'] = $profile user->last_name . ' ' . $profileuser->first_name;488 } 489 490 if ( ! in_array( $profile user->display_name, $public_display, true ) ) { // Only add this if it isn't duplicated elsewhere.491 $public_display = array( 'display_displayname' => $profile user->display_name ) + $public_display;474 $public_display['display_nickname'] = $profile_user->nickname; 475 $public_display['display_username'] = $profile_user->user_login; 476 477 if ( ! empty( $profile_user->first_name ) ) { 478 $public_display['display_firstname'] = $profile_user->first_name; 479 } 480 481 if ( ! empty( $profile_user->last_name ) ) { 482 $public_display['display_lastname'] = $profile_user->last_name; 483 } 484 485 if ( ! empty( $profile_user->first_name ) && ! empty( $profile_user->last_name ) ) { 486 $public_display['display_firstlast'] = $profile_user->first_name . ' ' . $profile_user->last_name; 487 $public_display['display_lastfirst'] = $profile_user->last_name . ' ' . $profile_user->first_name; 488 } 489 490 if ( ! in_array( $profile_user->display_name, $public_display, true ) ) { // Only add this if it isn't duplicated elsewhere. 491 $public_display = array( 'display_displayname' => $profile_user->display_name ) + $public_display; 492 492 } 493 493 … … 497 497 foreach ( $public_display as $id => $item ) { 498 498 ?> 499 <option <?php selected( $profile user->display_name, $item ); ?>><?php echo $item; ?></option>499 <option <?php selected( $profile_user->display_name, $item ); ?>><?php echo $item; ?></option> 500 500 <?php 501 501 } … … 511 511 <tr class="user-email-wrap"> 512 512 <th><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> 513 <td><input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profile user->user_email ); ?>" class="regular-text ltr" />514 <?php 515 if ( $profile user->ID === $current_user->ID ) :513 <td><input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profile_user->user_email ); ?>" class="regular-text ltr" /> 514 <?php 515 if ( $profile_user->ID === $current_user->ID ) : 516 516 ?> 517 517 <p class="description" id="email-description"> … … 522 522 523 523 $new_email = get_user_meta( $current_user->ID, '_new_email', true ); 524 if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile user->ID === $current_user->ID ) :524 if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) : 525 525 ?> 526 526 <div class="updated inline"> … … 546 546 <tr class="user-url-wrap"> 547 547 <th><label for="url"><?php _e( 'Website' ); ?></label></th> 548 <td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profile user->user_url ); ?>" class="regular-text code" /></td>549 </tr> 550 551 <?php 552 foreach ( wp_get_user_contact_methods( $profile user ) as $name => $desc ) {548 <td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profile_user->user_url ); ?>" class="regular-text code" /></td> 549 </tr> 550 551 <?php 552 foreach ( wp_get_user_contact_methods( $profile_user ) as $name => $desc ) { 553 553 ?> 554 554 <tr class="user-<?php echo $name; ?>-wrap"> … … 568 568 ?> 569 569 </label></th> 570 <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profile user->$name ); ?>" class="regular-text" /></td>570 <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profile_user->$name ); ?>" class="regular-text" /></td> 571 571 </tr> 572 572 <?php … … 580 580 <tr class="user-description-wrap"> 581 581 <th><label for="description"><?php _e( 'Biographical Info' ); ?></label></th> 582 <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profile user->description; // textarea_escaped ?></textarea>582 <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profile_user->description; // textarea_escaped ?></textarea> 583 583 <p class="description"><?php _e( 'Share a little biographical information to fill out your profile. This may be shown publicly.' ); ?></p></td> 584 584 </tr> … … 605 605 * 606 606 * @since 4.4.0 607 * @since 4.7.0 Added the `$profile user` parameter.608 * 609 * @param string $description The description that will be printed.610 * @param WP_User $profile user The current WP_User object.607 * @since 4.7.0 Added the `$profile_user` parameter. 608 * 609 * @param string $description The description that will be printed. 610 * @param WP_User $profile_user The current WP_User object. 611 611 */ 612 echo apply_filters( 'user_profile_picture_description', $description, $profile user );612 echo apply_filters( 'user_profile_picture_description', $description, $profile_user ); 613 613 ?> 614 614 </p> … … 621 621 * 622 622 * @since 1.5.1 623 * @since 2.8.0 Added the `$profile user` parameter.623 * @since 2.8.0 Added the `$profile_user` parameter. 624 624 * @since 4.4.0 Now evaluated only in user-edit.php. 625 625 * 626 * @param bool $show Whether to show the password fields. Default true.627 * @param WP_User $profile user User object for the current user to edit.626 * @param bool $show Whether to show the password fields. Default true. 627 * @param WP_User $profile_user User object for the current user to edit. 628 628 */ 629 $show_password_fields = apply_filters( 'show_password_fields', true, $profile user );629 $show_password_fields = apply_filters( 'show_password_fields', true, $profile_user ); 630 630 if ( $show_password_fields ) : 631 631 ?> … … 691 691 <p class="description"> 692 692 <?php 693 /* translators: %s: User's display name. */ 694 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 ) ); 693 printf( 694 /* translators: %s: User's display name. */ 695 __( 'Send %s a link to reset their password. This will not change their password, nor will it force a change.' ), 696 esc_html( $profile_user->display_name ) 697 ); 695 698 ?> 696 699 </p> … … 729 732 <?php 730 733 /* translators: %s: User's display name. */ 731 printf( __( 'Log %s out of all locations.' ), $profile user->display_name );734 printf( __( 'Log %s out of all locations.' ), $profile_user->display_name ); 732 735 ?> 733 736 </p> … … 782 785 * @since 5.6.0 783 786 * 784 * @param WP_User $profile user The current WP_User object.787 * @param WP_User $profile_user The current WP_User object. 785 788 */ 786 do_action( 'wp_create_application_password_form', $profile user );789 do_action( 'wp_create_application_password_form', $profile_user ); 787 790 ?> 788 791 … … 826 829 * @since 2.0.0 827 830 * 828 * @param WP_User $profile user The current WP_User object.831 * @param WP_User $profile_user The current WP_User object. 829 832 */ 830 do_action( 'show_user_profile', $profile user );833 do_action( 'show_user_profile', $profile_user ); 831 834 } else { 832 835 /** … … 835 838 * @since 2.0.0 836 839 * 837 * @param WP_User $profile user The current WP_User object.840 * @param WP_User $profile_user The current WP_User object. 838 841 */ 839 do_action( 'edit_user_profile', $profile user );842 do_action( 'edit_user_profile', $profile_user ); 840 843 } 841 844 ?> … … 851 854 * @since 2.8.0 852 855 * 853 * @param bool $enable Whether to display the capabilities. Default true.854 * @param WP_User $profile user The current WP_User object.856 * @param bool $enable Whether to display the capabilities. Default true. 857 * @param WP_User $profile_user The current WP_User object. 855 858 */ 856 if ( count( $profile user->caps ) > count( $profileuser->roles )857 && apply_filters( 'additional_capabilities_display', true, $profileuser )859 if ( count( $profile_user->caps ) > count( $profile_user->roles ) 860 && apply_filters( 'additional_capabilities_display', true, $profile_user ) 858 861 ) : 859 862 ?> … … 865 868 <?php 866 869 $output = ''; 867 foreach ( $profile user->caps as $cap => $value ) {870 foreach ( $profile_user->caps as $cap => $value ) { 868 871 if ( ! $wp_roles->is_role( $cap ) ) { 869 872 if ( '' !== $output ) {
Note: See TracChangeset
for help on using the changeset viewer.