Edit File by line
/home/barbar84/public_h.../wp-admin
File: user-edit.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Edit user administration panel.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/** WordPress Administration Bootstrap */
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
[10] Fix | Delete
wp_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) );
[11] Fix | Delete
[12] Fix | Delete
$user_id = (int) $user_id;
[13] Fix | Delete
$current_user = wp_get_current_user();
[14] Fix | Delete
if ( ! defined( 'IS_PROFILE_PAGE' ) ) {
[15] Fix | Delete
define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
if ( ! $user_id && IS_PROFILE_PAGE ) {
[19] Fix | Delete
$user_id = $current_user->ID;
[20] Fix | Delete
} elseif ( ! $user_id && ! IS_PROFILE_PAGE ) {
[21] Fix | Delete
wp_die( __( 'Invalid user ID.' ) );
[22] Fix | Delete
} elseif ( ! get_userdata( $user_id ) ) {
[23] Fix | Delete
wp_die( __( 'Invalid user ID.' ) );
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
wp_enqueue_script( 'user-profile' );
[27] Fix | Delete
[28] Fix | Delete
if ( wp_is_application_passwords_available_for_user( $user_id ) ) {
[29] Fix | Delete
wp_enqueue_script( 'application-passwords' );
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
if ( IS_PROFILE_PAGE ) {
[33] Fix | Delete
$title = __( 'Profile' );
[34] Fix | Delete
} else {
[35] Fix | Delete
/* translators: %s: User's display name. */
[36] Fix | Delete
$title = __( 'Edit User %s' );
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
if ( current_user_can( 'edit_users' ) && ! IS_PROFILE_PAGE ) {
[40] Fix | Delete
$submenu_file = 'users.php';
[41] Fix | Delete
} else {
[42] Fix | Delete
$submenu_file = 'profile.php';
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
if ( current_user_can( 'edit_users' ) && ! is_user_admin() ) {
[46] Fix | Delete
$parent_file = 'users.php';
[47] Fix | Delete
} else {
[48] Fix | Delete
$parent_file = 'profile.php';
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
$profile_help = '<p>' . __( 'Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.' ) . '</p>' .
[52] Fix | Delete
'<p>' . __( 'You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.' ) . '</p>' .
[53] Fix | Delete
'<p>' . __( 'You can select the language you wish to use while using the WordPress administration screen without affecting the language site visitors see.' ) . '</p>' .
[54] Fix | Delete
'<p>' . __( 'Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.' ) . '</p>' .
[55] Fix | Delete
'<p>' . __( 'You can log out of other devices, such as your phone or a public computer, by clicking the Log Out Everywhere Else button.' ) . '</p>' .
[56] Fix | Delete
'<p>' . __( 'Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.' ) . '</p>' .
[57] Fix | Delete
'<p>' . __( 'Remember to click the Update Profile button when you are finished.' ) . '</p>';
[58] Fix | Delete
[59] Fix | Delete
get_current_screen()->add_help_tab(
[60] Fix | Delete
array(
[61] Fix | Delete
'id' => 'overview',
[62] Fix | Delete
'title' => __( 'Overview' ),
[63] Fix | Delete
'content' => $profile_help,
[64] Fix | Delete
)
[65] Fix | Delete
);
[66] Fix | Delete
[67] Fix | Delete
get_current_screen()->set_help_sidebar(
[68] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[69] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/users-your-profile-screen/">Documentation on User Profiles</a>' ) . '</p>' .
[70] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[71] Fix | Delete
);
[72] Fix | Delete
[73] Fix | Delete
$wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer );
[74] Fix | Delete
[75] Fix | Delete
$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Filters whether to allow administrators on Multisite to edit every user.
[79] Fix | Delete
*
[80] Fix | Delete
* Enabling the user editing form via this filter also hinges on the user holding
[81] Fix | Delete
* the 'manage_network_users' cap, and the logged-in user not matching the user
[82] Fix | Delete
* profile open for editing.
[83] Fix | Delete
*
[84] Fix | Delete
* The filter was introduced to replace the EDIT_ANY_USER constant.
[85] Fix | Delete
*
[86] Fix | Delete
* @since 3.0.0
[87] Fix | Delete
*
[88] Fix | Delete
* @param bool $allow Whether to allow editing of any user. Default true.
[89] Fix | Delete
*/
[90] Fix | Delete
if ( is_multisite()
[91] Fix | Delete
&& ! current_user_can( 'manage_network_users' )
[92] Fix | Delete
&& $user_id != $current_user->ID
[93] Fix | Delete
&& ! apply_filters( 'enable_edit_any_user_configuration', true )
[94] Fix | Delete
) {
[95] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to edit this user.' ) );
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
// Execute confirmed email change. See send_confirmation_on_profile_email().
[99] Fix | Delete
if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) {
[100] Fix | Delete
$new_email = get_user_meta( $current_user->ID, '_new_email', true );
[101] Fix | Delete
if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) {
[102] Fix | Delete
$user = new stdClass;
[103] Fix | Delete
$user->ID = $current_user->ID;
[104] Fix | Delete
$user->user_email = esc_html( trim( $new_email['newemail'] ) );
[105] Fix | Delete
if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
[106] Fix | Delete
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
[107] Fix | Delete
}
[108] Fix | Delete
wp_update_user( $user );
[109] Fix | Delete
delete_user_meta( $current_user->ID, '_new_email' );
[110] Fix | Delete
wp_redirect( add_query_arg( array( 'updated' => 'true' ), self_admin_url( 'profile.php' ) ) );
[111] Fix | Delete
die();
[112] Fix | Delete
} else {
[113] Fix | Delete
wp_redirect( add_query_arg( array( 'error' => 'new-email' ), self_admin_url( 'profile.php' ) ) );
[114] Fix | Delete
}
[115] Fix | Delete
} elseif ( IS_PROFILE_PAGE && ! empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' === $_GET['dismiss'] ) {
[116] Fix | Delete
check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
[117] Fix | Delete
delete_user_meta( $current_user->ID, '_new_email' );
[118] Fix | Delete
wp_redirect( add_query_arg( array( 'updated' => 'true' ), self_admin_url( 'profile.php' ) ) );
[119] Fix | Delete
die();
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
switch ( $action ) {
[123] Fix | Delete
case 'update':
[124] Fix | Delete
check_admin_referer( 'update-user_' . $user_id );
[125] Fix | Delete
[126] Fix | Delete
if ( ! current_user_can( 'edit_user', $user_id ) ) {
[127] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to edit this user.' ) );
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
if ( IS_PROFILE_PAGE ) {
[131] Fix | Delete
/**
[132] Fix | Delete
* Fires before the page loads on the 'Profile' editing screen.
[133] Fix | Delete
*
[134] Fix | Delete
* The action only fires if the current user is editing their own profile.
[135] Fix | Delete
*
[136] Fix | Delete
* @since 2.0.0
[137] Fix | Delete
*
[138] Fix | Delete
* @param int $user_id The user ID.
[139] Fix | Delete
*/
[140] Fix | Delete
do_action( 'personal_options_update', $user_id );
[141] Fix | Delete
} else {
[142] Fix | Delete
/**
[143] Fix | Delete
* Fires before the page loads on the 'Edit User' screen.
[144] Fix | Delete
*
[145] Fix | Delete
* @since 2.7.0
[146] Fix | Delete
*
[147] Fix | Delete
* @param int $user_id The user ID.
[148] Fix | Delete
*/
[149] Fix | Delete
do_action( 'edit_user_profile_update', $user_id );
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
// Update the email address in signups, if present.
[153] Fix | Delete
if ( is_multisite() ) {
[154] Fix | Delete
$user = get_userdata( $user_id );
[155] Fix | Delete
[156] Fix | Delete
if ( $user->user_login && isset( $_POST['email'] ) && is_email( $_POST['email'] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) {
[157] Fix | Delete
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST['email'], $user_login ) );
[158] Fix | Delete
}
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
// Update the user.
[162] Fix | Delete
$errors = edit_user( $user_id );
[163] Fix | Delete
[164] Fix | Delete
// Grant or revoke super admin status if requested.
[165] Fix | Delete
if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) ) {
[166] Fix | Delete
empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
if ( ! is_wp_error( $errors ) ) {
[170] Fix | Delete
$redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
[171] Fix | Delete
if ( $wp_http_referer ) {
[172] Fix | Delete
$redirect = add_query_arg( 'wp_http_referer', urlencode( $wp_http_referer ), $redirect );
[173] Fix | Delete
}
[174] Fix | Delete
wp_redirect( $redirect );
[175] Fix | Delete
exit;
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
// Intentional fall-through to display $errors.
[179] Fix | Delete
default:
[180] Fix | Delete
$profileuser = get_user_to_edit( $user_id );
[181] Fix | Delete
[182] Fix | Delete
if ( ! current_user_can( 'edit_user', $user_id ) ) {
[183] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to edit this user.' ) );
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
$title = sprintf( $title, $profileuser->display_name );
[187] Fix | Delete
$sessions = WP_Session_Tokens::get_instance( $profileuser->ID );
[188] Fix | Delete
[189] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[190] Fix | Delete
?>
[191] Fix | Delete
[192] Fix | Delete
<?php if ( ! IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
[193] Fix | Delete
<div class="notice notice-info"><p><strong><?php _e( 'Important:' ); ?></strong> <?php _e( 'This user has super admin privileges.' ); ?></p></div>
[194] Fix | Delete
<?php } ?>
[195] Fix | Delete
<?php if ( isset( $_GET['updated'] ) ) : ?>
[196] Fix | Delete
<div id="message" class="updated notice is-dismissible">
[197] Fix | Delete
<?php if ( IS_PROFILE_PAGE ) : ?>
[198] Fix | Delete
<p><strong><?php _e( 'Profile updated.' ); ?></strong></p>
[199] Fix | Delete
<?php else : ?>
[200] Fix | Delete
<p><strong><?php _e( 'User updated.' ); ?></strong></p>
[201] Fix | Delete
<?php endif; ?>
[202] Fix | Delete
<?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
[203] Fix | Delete
<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>
[204] Fix | Delete
<?php endif; ?>
[205] Fix | Delete
</div>
[206] Fix | Delete
<?php endif; ?>
[207] Fix | Delete
<?php if ( isset( $_GET['error'] ) ) : ?>
[208] Fix | Delete
<div class="notice notice-error">
[209] Fix | Delete
<?php if ( 'new-email' === $_GET['error'] ) : ?>
[210] Fix | Delete
<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
[211] Fix | Delete
<?php endif; ?>
[212] Fix | Delete
</div>
[213] Fix | Delete
<?php endif; ?>
[214] Fix | Delete
<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
[215] Fix | Delete
<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
[216] Fix | Delete
<?php endif; ?>
[217] Fix | Delete
[218] Fix | Delete
<div class="wrap" id="profile-page">
[219] Fix | Delete
<h1 class="wp-heading-inline">
[220] Fix | Delete
<?php
[221] Fix | Delete
echo esc_html( $title );
[222] Fix | Delete
?>
[223] Fix | Delete
</h1>
[224] Fix | Delete
[225] Fix | Delete
<?php
[226] Fix | Delete
if ( ! IS_PROFILE_PAGE ) {
[227] Fix | Delete
if ( current_user_can( 'create_users' ) ) {
[228] Fix | Delete
?>
[229] Fix | Delete
<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
[230] Fix | Delete
<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
[231] Fix | Delete
<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
[232] Fix | Delete
<?php
[233] Fix | Delete
}
[234] Fix | Delete
}
[235] Fix | Delete
?>
[236] Fix | Delete
[237] Fix | Delete
<hr class="wp-header-end">
[238] Fix | Delete
[239] Fix | Delete
<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post" novalidate="novalidate"
[240] Fix | Delete
<?php
[241] Fix | Delete
/**
[242] Fix | Delete
* Fires inside the your-profile form tag on the user editing screen.
[243] Fix | Delete
*
[244] Fix | Delete
* @since 3.0.0
[245] Fix | Delete
*/
[246] Fix | Delete
do_action( 'user_edit_form_tag' );
[247] Fix | Delete
?>
[248] Fix | Delete
>
[249] Fix | Delete
<?php wp_nonce_field( 'update-user_' . $user_id ); ?>
[250] Fix | Delete
<?php if ( $wp_http_referer ) : ?>
[251] Fix | Delete
<input type="hidden" name="wp_http_referer" value="<?php echo esc_url( $wp_http_referer ); ?>" />
[252] Fix | Delete
<?php endif; ?>
[253] Fix | Delete
<p>
[254] Fix | Delete
<input type="hidden" name="from" value="profile" />
[255] Fix | Delete
<input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" />
[256] Fix | Delete
</p>
[257] Fix | Delete
[258] Fix | Delete
<h2><?php _e( 'Personal Options' ); ?></h2>
[259] Fix | Delete
[260] Fix | Delete
<table class="form-table" role="presentation">
[261] Fix | Delete
<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
[262] Fix | Delete
<tr class="user-rich-editing-wrap">
[263] Fix | Delete
<th scope="row"><?php _e( 'Visual Editor' ); ?></th>
[264] Fix | Delete
<td>
[265] Fix | Delete
<label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked( 'false', $profileuser->rich_editing ); ?> />
[266] Fix | Delete
<?php _e( 'Disable the visual editor when writing' ); ?>
[267] Fix | Delete
</label>
[268] Fix | Delete
</td>
[269] Fix | Delete
</tr>
[270] Fix | Delete
<?php endif; ?>
[271] Fix | Delete
<?php
[272] Fix | Delete
$show_syntax_highlighting_preference = (
[273] Fix | Delete
// For Custom HTML widget and Additional CSS in Customizer.
[274] Fix | Delete
user_can( $profileuser, 'edit_theme_options' )
[275] Fix | Delete
||
[276] Fix | Delete
// Edit plugins.
[277] Fix | Delete
user_can( $profileuser, 'edit_plugins' )
[278] Fix | Delete
||
[279] Fix | Delete
// Edit themes.
[280] Fix | Delete
user_can( $profileuser, 'edit_themes' )
[281] Fix | Delete
);
[282] Fix | Delete
?>
[283] Fix | Delete
[284] Fix | Delete
<?php if ( $show_syntax_highlighting_preference ) : ?>
[285] Fix | Delete
<tr class="user-syntax-highlighting-wrap">
[286] Fix | Delete
<th scope="row"><?php _e( 'Syntax Highlighting' ); ?></th>
[287] Fix | Delete
<td>
[288] Fix | Delete
<label for="syntax_highlighting"><input name="syntax_highlighting" type="checkbox" id="syntax_highlighting" value="false" <?php checked( 'false', $profileuser->syntax_highlighting ); ?> />
[289] Fix | Delete
<?php _e( 'Disable syntax highlighting when editing code' ); ?>
[290] Fix | Delete
</label>
[291] Fix | Delete
</td>
[292] Fix | Delete
</tr>
[293] Fix | Delete
<?php endif; ?>
[294] Fix | Delete
[295] Fix | Delete
<?php if ( count( $_wp_admin_css_colors ) > 1 && has_action( 'admin_color_scheme_picker' ) ) : ?>
[296] Fix | Delete
<tr class="user-admin-color-wrap">
[297] Fix | Delete
<th scope="row"><?php _e( 'Admin Color Scheme' ); ?></th>
[298] Fix | Delete
<td>
[299] Fix | Delete
<?php
[300] Fix | Delete
/**
[301] Fix | Delete
* Fires in the 'Admin Color Scheme' section of the user editing screen.
[302] Fix | Delete
*
[303] Fix | Delete
* The section is only enabled if a callback is hooked to the action,
[304] Fix | Delete
* and if there is more than one defined color scheme for the admin.
[305] Fix | Delete
*
[306] Fix | Delete
* @since 3.0.0
[307] Fix | Delete
* @since 3.8.1 Added `$user_id` parameter.
[308] Fix | Delete
*
[309] Fix | Delete
* @param int $user_id The user ID.
[310] Fix | Delete
*/
[311] Fix | Delete
do_action( 'admin_color_scheme_picker', $user_id );
[312] Fix | Delete
?>
[313] Fix | Delete
</td>
[314] Fix | Delete
</tr>
[315] Fix | Delete
<?php endif; // End if count ( $_wp_admin_css_colors ) > 1 ?>
[316] Fix | Delete
[317] Fix | Delete
<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
[318] Fix | Delete
<tr class="user-comment-shortcuts-wrap">
[319] Fix | Delete
<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
[320] Fix | Delete
<td>
[321] Fix | Delete
<label for="comment_shortcuts">
[322] Fix | Delete
<input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( 'true', $profileuser->comment_shortcuts ); ?> />
[323] Fix | Delete
<?php _e( 'Enable keyboard shortcuts for comment moderation.' ); ?>
[324] Fix | Delete
</label>
[325] Fix | Delete
<?php _e( '<a href="https://wordpress.org/support/article/keyboard-shortcuts/" target="_blank">More information</a>' ); ?>
[326] Fix | Delete
</td>
[327] Fix | Delete
</tr>
[328] Fix | Delete
<?php endif; ?>
[329] Fix | Delete
[330] Fix | Delete
<tr class="show-admin-bar user-admin-bar-front-wrap">
[331] Fix | Delete
<th scope="row"><?php _e( 'Toolbar' ); ?></th>
[332] Fix | Delete
<td>
[333] Fix | Delete
<label for="admin_bar_front">
[334] Fix | Delete
<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
[335] Fix | Delete
<?php _e( 'Show Toolbar when viewing site' ); ?>
[336] Fix | Delete
</label><br />
[337] Fix | Delete
</td>
[338] Fix | Delete
</tr>
[339] Fix | Delete
[340] Fix | Delete
<?php
[341] Fix | Delete
$languages = get_available_languages();
[342] Fix | Delete
if ( $languages ) :
[343] Fix | Delete
?>
[344] Fix | Delete
<tr class="user-language-wrap">
[345] Fix | Delete
<th scope="row">
[346] Fix | Delete
<?php /* translators: The user language selection field label. */ ?>
[347] Fix | Delete
<label for="locale"><?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label>
[348] Fix | Delete
</th>
[349] Fix | Delete
<td>
[350] Fix | Delete
<?php
[351] Fix | Delete
$user_locale = $profileuser->locale;
[352] Fix | Delete
[353] Fix | Delete
if ( 'en_US' === $user_locale ) {
[354] Fix | Delete
$user_locale = '';
[355] Fix | Delete
} elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {
[356] Fix | Delete
$user_locale = 'site-default';
[357] Fix | Delete
}
[358] Fix | Delete
[359] Fix | Delete
wp_dropdown_languages(
[360] Fix | Delete
array(
[361] Fix | Delete
'name' => 'locale',
[362] Fix | Delete
'id' => 'locale',
[363] Fix | Delete
'selected' => $user_locale,
[364] Fix | Delete
'languages' => $languages,
[365] Fix | Delete
'show_available_translations' => false,
[366] Fix | Delete
'show_option_site_default' => true,
[367] Fix | Delete
)
[368] Fix | Delete
);
[369] Fix | Delete
?>
[370] Fix | Delete
</td>
[371] Fix | Delete
</tr>
[372] Fix | Delete
<?php
[373] Fix | Delete
endif;
[374] Fix | Delete
?>
[375] Fix | Delete
[376] Fix | Delete
<?php
[377] Fix | Delete
/**
[378] Fix | Delete
* Fires at the end of the 'Personal Options' settings table on the user editing screen.
[379] Fix | Delete
*
[380] Fix | Delete
* @since 2.7.0
[381] Fix | Delete
*
[382] Fix | Delete
* @param WP_User $profileuser The current WP_User object.
[383] Fix | Delete
*/
[384] Fix | Delete
do_action( 'personal_options', $profileuser );
[385] Fix | Delete
?>
[386] Fix | Delete
[387] Fix | Delete
</table>
[388] Fix | Delete
<?php
[389] Fix | Delete
if ( IS_PROFILE_PAGE ) {
[390] Fix | Delete
/**
[391] Fix | Delete
* Fires after the 'Personal Options' settings table on the 'Profile' editing screen.
[392] Fix | Delete
*
[393] Fix | Delete
* The action only fires if the current user is editing their own profile.
[394] Fix | Delete
*
[395] Fix | Delete
* @since 2.0.0
[396] Fix | Delete
*
[397] Fix | Delete
* @param WP_User $profileuser The current WP_User object.
[398] Fix | Delete
*/
[399] Fix | Delete
do_action( 'profile_personal_options', $profileuser );
[400] Fix | Delete
}
[401] Fix | Delete
?>
[402] Fix | Delete
[403] Fix | Delete
<h2><?php _e( 'Name' ); ?></h2>
[404] Fix | Delete
[405] Fix | Delete
<table class="form-table" role="presentation">
[406] Fix | Delete
<tr class="user-user-login-wrap">
[407] Fix | Delete
<th><label for="user_login"><?php _e( 'Username' ); ?></label></th>
[408] Fix | Delete
<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>
[409] Fix | Delete
</tr>
[410] Fix | Delete
[411] Fix | Delete
<?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profileuser->ID ) ) : ?>
[412] Fix | Delete
<tr class="user-role-wrap"><th><label for="role"><?php _e( 'Role' ); ?></label></th>
[413] Fix | Delete
<td><select name="role" id="role">
[414] Fix | Delete
<?php
[415] Fix | Delete
// Compare user role against currently editable roles.
[416] Fix | Delete
$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
[417] Fix | Delete
$user_role = reset( $user_roles );
[418] Fix | Delete
[419] Fix | Delete
// Print the full list of roles with the primary one selected.
[420] Fix | Delete
wp_dropdown_roles( $user_role );
[421] Fix | Delete
[422] Fix | Delete
// Print the 'no role' option. Make it selected if the user has no role yet.
[423] Fix | Delete
if ( $user_role ) {
[424] Fix | Delete
echo '<option value="">' . __( '&mdash; No role for this site &mdash;' ) . '</option>';
[425] Fix | Delete
} else {
[426] Fix | Delete
echo '<option value="" selected="selected">' . __( '&mdash; No role for this site &mdash;' ) . '</option>';
[427] Fix | Delete
}
[428] Fix | Delete
?>
[429] Fix | Delete
</select></td></tr>
[430] Fix | Delete
<?php
[431] Fix | Delete
endif; // End if ! IS_PROFILE_PAGE.
[432] Fix | Delete
[433] Fix | Delete
if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) ) {
[434] Fix | Delete
?>
[435] Fix | Delete
<tr class="user-super-admin-wrap"><th><?php _e( 'Super Admin' ); ?></th>
[436] Fix | Delete
<td>
[437] Fix | Delete
<?php if ( 0 !== strcasecmp( $profileuser->user_email, get_site_option( 'admin_email' ) ) || ! is_super_admin( $profileuser->ID ) ) : ?>
[438] Fix | Delete
<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>
[439] Fix | Delete
<?php else : ?>
[440] Fix | Delete
<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
[441] Fix | Delete
<?php endif; ?>
[442] Fix | Delete
</td></tr>
[443] Fix | Delete
<?php } ?>
[444] Fix | Delete
[445] Fix | Delete
<tr class="user-first-name-wrap">
[446] Fix | Delete
<th><label for="first_name"><?php _e( 'First Name' ); ?></label></th>
[447] Fix | Delete
<td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" /></td>
[448] Fix | Delete
</tr>
[449] Fix | Delete
[450] Fix | Delete
<tr class="user-last-name-wrap">
[451] Fix | Delete
<th><label for="last_name"><?php _e( 'Last Name' ); ?></label></th>
[452] Fix | Delete
<td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" /></td>
[453] Fix | Delete
</tr>
[454] Fix | Delete
[455] Fix | Delete
<tr class="user-nickname-wrap">
[456] Fix | Delete
<th><label for="nickname"><?php _e( 'Nickname' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
[457] Fix | Delete
<td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" /></td>
[458] Fix | Delete
</tr>
[459] Fix | Delete
[460] Fix | Delete
<tr class="user-display-name-wrap">
[461] Fix | Delete
<th><label for="display_name"><?php _e( 'Display name publicly as' ); ?></label></th>
[462] Fix | Delete
<td>
[463] Fix | Delete
<select name="display_name" id="display_name">
[464] Fix | Delete
<?php
[465] Fix | Delete
$public_display = array();
[466] Fix | Delete
$public_display['display_nickname'] = $profileuser->nickname;
[467] Fix | Delete
$public_display['display_username'] = $profileuser->user_login;
[468] Fix | Delete
[469] Fix | Delete
if ( ! empty( $profileuser->first_name ) ) {
[470] Fix | Delete
$public_display['display_firstname'] = $profileuser->first_name;
[471] Fix | Delete
}
[472] Fix | Delete
[473] Fix | Delete
if ( ! empty( $profileuser->last_name ) ) {
[474] Fix | Delete
$public_display['display_lastname'] = $profileuser->last_name;
[475] Fix | Delete
}
[476] Fix | Delete
[477] Fix | Delete
if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {
[478] Fix | Delete
$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
[479] Fix | Delete
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
[480] Fix | Delete
}
[481] Fix | Delete
[482] Fix | Delete
if ( ! in_array( $profileuser->display_name, $public_display, true ) ) { // Only add this if it isn't duplicated elsewhere.
[483] Fix | Delete
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
$public_display = array_map( 'trim', $public_display );
[487] Fix | Delete
$public_display = array_unique( $public_display );
[488] Fix | Delete
[489] Fix | Delete
foreach ( $public_display as $id => $item ) {
[490] Fix | Delete
?>
[491] Fix | Delete
<option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
[492] Fix | Delete
<?php
[493] Fix | Delete
}
[494] Fix | Delete
?>
[495] Fix | Delete
</select>
[496] Fix | Delete
</td>
[497] Fix | Delete
</tr>
[498] Fix | Delete
</table>
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function