Issues (4967)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/wp-admin/user-edit.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Edit user administration panel.
4
 *
5
 * @package WordPress
6
 * @subpackage Administration
7
 */
8
9
/** WordPress Administration Bootstrap */
10
require_once( dirname( __FILE__ ) . '/admin.php' );
11
12
wp_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) );
13
14
$user_id = (int) $user_id;
15
$current_user = wp_get_current_user();
16
if ( ! defined( 'IS_PROFILE_PAGE' ) )
17
	define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
18
19
if ( ! $user_id && IS_PROFILE_PAGE )
20
	$user_id = $current_user->ID;
21
elseif ( ! $user_id && ! IS_PROFILE_PAGE )
22
	wp_die(__( 'Invalid user ID.' ) );
23
elseif ( ! get_userdata( $user_id ) )
24
	wp_die( __('Invalid user ID.') );
25
26
wp_enqueue_script('user-profile');
27
28
if ( IS_PROFILE_PAGE ) {
29
	$title = __( 'Profile' );
30
} else {
31
	/* translators: %s: user's display name */
32
	$title = __( 'Edit User %s' );
33
}
34
35
if ( current_user_can('edit_users') && !IS_PROFILE_PAGE )
36
	$submenu_file = 'users.php';
37
else
38
	$submenu_file = 'profile.php';
39
40
if ( current_user_can('edit_users') && !is_user_admin() )
41
	$parent_file = 'users.php';
42
else
43
	$parent_file = 'profile.php';
44
45
$profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
46
	'<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>' .
47
	'<p>' . __( 'You can select the language you wish to use while using the WordPress administration screen without affecting the language site visitors see.' ) . '</p>' .
48
	'<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>' .
49
	'<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>' .
50
	'<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>' .
51
	'<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>';
52
53
get_current_screen()->add_help_tab( array(
54
	'id'      => 'overview',
55
	'title'   => __('Overview'),
56
	'content' => $profile_help,
57
) );
58
59
get_current_screen()->set_help_sidebar(
60
    '<p><strong>' . __('For more information:') . '</strong></p>' .
61
    '<p>' . __('<a href="https://codex.wordpress.org/Users_Your_Profile_Screen">Documentation on User Profiles</a>') . '</p>' .
62
    '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
63
);
64
65
$wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer );
66
67
$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
68
69
/**
70
 * Filters whether to allow administrators on Multisite to edit every user.
71
 *
72
 * Enabling the user editing form via this filter also hinges on the user holding
73
 * the 'manage_network_users' cap, and the logged-in user not matching the user
74
 * profile open for editing.
75
 *
76
 * The filter was introduced to replace the EDIT_ANY_USER constant.
77
 *
78
 * @since 3.0.0
79
 *
80
 * @param bool $allow Whether to allow editing of any user. Default true.
81
 */
82
if ( is_multisite()
83
	&& ! current_user_can( 'manage_network_users' )
84
	&& $user_id != $current_user->ID
85
	&& ! apply_filters( 'enable_edit_any_user_configuration', true )
86
) {
87
	wp_die( __( 'Sorry, you are not allowed to edit this user.' ) );
88
}
89
90
// Execute confirmed email change. See send_confirmation_on_profile_email().
91
if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
92
	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
93
	if ( $new_email && hash_equals( $new_email[ 'hash' ], $_GET[ 'newuseremail' ] ) ) {
94
		$user = new stdClass;
95
		$user->ID = $current_user->ID;
96
		$user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
97
		if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
98
			$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
99
		}
100
		wp_update_user( $user );
101
		delete_user_meta( $current_user->ID, '_new_email' );
102
		wp_redirect( add_query_arg( array( 'updated' => 'true' ), self_admin_url( 'profile.php' ) ) );
103
		die();
104
	} else {
105
		wp_redirect( add_query_arg( array( 'error' => 'new-email' ), self_admin_url( 'profile.php' ) ) );
106
	}
107
} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' === $_GET['dismiss'] ) {
108
	check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
109
	delete_user_meta( $current_user->ID, '_new_email' );
110
	wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
111
	die();
112
}
113
114
switch ($action) {
115
case 'update':
116
117
check_admin_referer('update-user_' . $user_id);
118
119
if ( !current_user_can('edit_user', $user_id) )
120
	wp_die(__('Sorry, you are not allowed to edit this user.'));
121
122
if ( IS_PROFILE_PAGE ) {
123
	/**
124
	 * Fires before the page loads on the 'Your Profile' editing screen.
125
	 *
126
	 * The action only fires if the current user is editing their own profile.
127
	 *
128
	 * @since 2.0.0
129
	 *
130
	 * @param int $user_id The user ID.
131
	 */
132
	do_action( 'personal_options_update', $user_id );
133
} else {
134
	/**
135
	 * Fires before the page loads on the 'Edit User' screen.
136
	 *
137
	 * @since 2.7.0
138
	 *
139
	 * @param int $user_id The user ID.
140
	 */
141
	do_action( 'edit_user_profile_update', $user_id );
142
}
143
144
// Update the email address in signups, if present.
145
if ( is_multisite() ) {
146
	$user = get_userdata( $user_id );
147
148
	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 ) ) ) {
149
		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) );
150
	}
151
}
152
153
// Update the user.
154
$errors = edit_user( $user_id );
155
156
// Grant or revoke super admin status if requested.
157
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 ) ) {
158
	empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
159
}
160
161
if ( !is_wp_error( $errors ) ) {
162
	$redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
163
	if ( $wp_http_referer )
164
		$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
165
	wp_redirect($redirect);
166
	exit;
167
}
168
169
default:
170
$profileuser = get_user_to_edit($user_id);
171
172
if ( !current_user_can('edit_user', $user_id) )
173
	wp_die(__('Sorry, you are not allowed to edit this user.'));
174
175
$title = sprintf( $title, $profileuser->display_name );
176
$sessions = WP_Session_Tokens::get_instance( $profileuser->ID );
177
178
include(ABSPATH . 'wp-admin/admin-header.php');
179
?>
180
181
<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
182
	<div class="notice notice-info"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
183
<?php } ?>
184
<?php if ( isset($_GET['updated']) ) : ?>
185
<div id="message" class="updated notice is-dismissible">
186
	<?php if ( IS_PROFILE_PAGE ) : ?>
187
	<p><strong><?php _e('Profile updated.') ?></strong></p>
188
	<?php else: ?>
189
	<p><strong><?php _e('User updated.') ?></strong></p>
190
	<?php endif; ?>
191
	<?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
192
	<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
193
	<?php endif; ?>
194
</div>
195
<?php endif; ?>
196
<?php if ( isset( $_GET['error'] ) ) : ?>
197
<div class="notice notice-error">
198
	<?php if ( 'new-email' == $_GET['error'] ) : ?>
199
	<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
200
	<?php endif; ?>
201
</div>
202
<?php endif; ?>
203
<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
204
<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
205
<?php endif; ?>
206
207
<div class="wrap" id="profile-page">
208
<h1 class="wp-heading-inline"><?php
209
echo esc_html( $title );
210
?></h1>
211
212
<?php
213
if ( ! IS_PROFILE_PAGE ) {
214 View Code Duplication
	if ( current_user_can( 'create_users' ) ) { ?>
215
		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
216
	<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
217
		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
218
	<?php }
219
}
220
?>
221
222
<hr class="wp-header-end">
223
224
<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post" novalidate="novalidate"<?php
225
	/**
226
	 * Fires inside the your-profile form tag on the user editing screen.
227
	 *
228
	 * @since 3.0.0
229
	 */
230
	do_action( 'user_edit_form_tag' );
231
?>>
232
<?php wp_nonce_field('update-user_' . $user_id) ?>
233
<?php if ( $wp_http_referer ) : ?>
234
	<input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
235
<?php endif; ?>
236
<p>
237
<input type="hidden" name="from" value="profile" />
238
<input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" />
239
</p>
240
241
<h2><?php _e( 'Personal Options' ); ?></h2>
242
243
<table class="form-table">
244 View Code Duplication
<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
245
	<tr class="user-rich-editing-wrap">
246
		<th scope="row"><?php _e( 'Visual Editor' ); ?></th>
247
		<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td>
248
	</tr>
249
<?php endif; ?>
250
<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
251
<tr class="user-admin-color-wrap">
252
<th scope="row"><?php _e('Admin Color Scheme')?></th>
253
<td><?php
254
	/**
255
	 * Fires in the 'Admin Color Scheme' section of the user editing screen.
256
	 *
257
	 * The section is only enabled if a callback is hooked to the action,
258
	 * and if there is more than one defined color scheme for the admin.
259
	 *
260
	 * @since 3.0.0
261
	 * @since 3.8.1 Added `$user_id` parameter.
262
	 *
263
	 * @param int $user_id The user ID.
264
	 */
265
	do_action( 'admin_color_scheme_picker', $user_id );
266
?></td>
267
</tr>
268
<?php
269
endif; // $_wp_admin_css_colors
270 View Code Duplication
if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
271
<tr class="user-comment-shortcuts-wrap">
272
<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
273
<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
274
</tr>
275
<?php endif; ?>
276
<tr class="show-admin-bar user-admin-bar-front-wrap">
277
<th scope="row"><?php _e( 'Toolbar' ); ?></th>
278
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Toolbar') ?></span></legend>
279
<label for="admin_bar_front">
280
<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
281
<?php _e( 'Show Toolbar when viewing site' ); ?></label><br />
282
</fieldset>
283
</td>
284
</tr>
285
286
<?php
287
$languages = get_available_languages();
288
if ( $languages ) : ?>
0 ignored issues
show
Bug Best Practice introduced by
The expression $languages of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
289
<tr class="user-language-wrap">
290
	<th scope="row">
291
		<?php /* translators: The user language selection field label */ ?>
292
		<label for="locale"><?php _e( 'Language' ); ?></label>
293
	</th>
294
	<td>
295
		<?php
296
		$user_locale = $profileuser->locale;
297
298 View Code Duplication
		if ( 'en_US' === $user_locale ) {
299
			$user_locale = '';
300
		} elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {
301
			$user_locale = 'site-default';
302
		}
303
304
		wp_dropdown_languages( array(
305
			'name'                        => 'locale',
306
			'id'                          => 'locale',
307
			'selected'                    => $user_locale,
308
			'languages'                   => $languages,
309
			'show_available_translations' => false,
310
			'show_option_site_default'    => true
311
		) );
312
		?>
313
	</td>
314
</tr>
315
<?php
316
endif;
317
?>
318
319
<?php
320
/**
321
 * Fires at the end of the 'Personal Options' settings table on the user editing screen.
322
 *
323
 * @since 2.7.0
324
 *
325
 * @param WP_User $profileuser The current WP_User object.
326
 */
327
do_action( 'personal_options', $profileuser );
328
?>
329
330
</table>
331
<?php
332
	if ( IS_PROFILE_PAGE ) {
333
		/**
334
		 * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
335
		 *
336
		 * The action only fires if the current user is editing their own profile.
337
		 *
338
		 * @since 2.0.0
339
		 *
340
		 * @param WP_User $profileuser The current WP_User object.
341
		 */
342
		do_action( 'profile_personal_options', $profileuser );
343
	}
344
?>
345
346
<h2><?php _e( 'Name' ); ?></h2>
347
348
<table class="form-table">
349
	<tr class="user-user-login-wrap">
350
		<th><label for="user_login"><?php _e('Username'); ?></label></th>
351
		<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>
352
	</tr>
353
354
<?php if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?>
355
<tr class="user-role-wrap"><th><label for="role"><?php _e('Role') ?></label></th>
356
<td><select name="role" id="role">
357
<?php
358
// Compare user role against currently editable roles
359
$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
360
$user_role  = reset( $user_roles );
361
362
// print the full list of roles with the primary one selected.
363
wp_dropdown_roles($user_role);
364
365
// print the 'no role' option. Make it selected if the user has no role yet.
366
if ( $user_role )
367
	echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
368
else
369
	echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
370
?>
371
</select></td></tr>
372
<?php endif; //!IS_PROFILE_PAGE
373
374
if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
375
<tr class="user-super-admin-wrap"><th><?php _e('Super Admin'); ?></th>
376
<td>
377
<?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
378
<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>
379
<?php else : ?>
380
<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
381
<?php endif; ?>
382
</td></tr>
383
<?php } ?>
384
385
<tr class="user-first-name-wrap">
386
	<th><label for="first_name"><?php _e('First Name') ?></label></th>
387
	<td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
388
</tr>
389
390
<tr class="user-last-name-wrap">
391
	<th><label for="last_name"><?php _e('Last Name') ?></label></th>
392
	<td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
393
</tr>
394
395
<tr class="user-nickname-wrap">
396
	<th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
397
	<td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td>
398
</tr>
399
400
<tr class="user-display-name-wrap">
401
	<th><label for="display_name"><?php _e('Display name publicly as') ?></label></th>
402
	<td>
403
		<select name="display_name" id="display_name">
404
		<?php
405
			$public_display = array();
406
			$public_display['display_nickname']  = $profileuser->nickname;
407
			$public_display['display_username']  = $profileuser->user_login;
408
409
			if ( !empty($profileuser->first_name) )
410
				$public_display['display_firstname'] = $profileuser->first_name;
411
412
			if ( !empty($profileuser->last_name) )
413
				$public_display['display_lastname'] = $profileuser->last_name;
414
415
			if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
416
				$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
417
				$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
418
			}
419
420
			if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
421
				$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
422
423
			$public_display = array_map( 'trim', $public_display );
424
			$public_display = array_unique( $public_display );
425
426
			foreach ( $public_display as $id => $item ) {
427
		?>
428
			<option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
429
		<?php
430
			}
431
		?>
432
		</select>
433
	</td>
434
</tr>
435
</table>
436
437
<h2><?php _e( 'Contact Info' ); ?></h2>
438
439
<table class="form-table">
440
<tr class="user-email-wrap">
441
	<th><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
442
	<td><input type="email" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text ltr" />
443
	<?php
444
	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
445
	if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
446
	<div class="updated inline">
447
	<p><?php
448
		printf(
449
			/* translators: %s: new email */
450
			__( 'There is a pending change of your email to %s.' ),
451
			'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
452
		);
453
		printf(
454
			' <a href="%1$s">%2$s</a>',
455
			esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
456
			__( 'Cancel' )
457
		);
458
	?></p>
459
	</div>
460
	<?php endif; ?>
461
	</td>
462
</tr>
463
464
<tr class="user-url-wrap">
465
	<th><label for="url"><?php _e('Website') ?></label></th>
466
	<td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ) ?>" class="regular-text code" /></td>
467
</tr>
468
469
<?php
470
	foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
471
?>
472
<tr class="user-<?php echo $name; ?>-wrap">
473
	<th><label for="<?php echo $name; ?>">
474
		<?php
475
		/**
476
		 * Filters a user contactmethod label.
477
		 *
478
		 * The dynamic portion of the filter hook, `$name`, refers to
479
		 * each of the keys in the contactmethods array.
480
		 *
481
		 * @since 2.9.0
482
		 *
483
		 * @param string $desc The translatable label for the contactmethod.
484
		 */
485
		echo apply_filters( "user_{$name}_label", $desc );
486
		?>
487
	</label></th>
488
	<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
489
</tr>
490
<?php
491
	}
492
?>
493
</table>
494
495
<h2><?php IS_PROFILE_PAGE ? _e( 'About Yourself' ) : _e( 'About the user' ); ?></h2>
496
497
<table class="form-table">
498
<tr class="user-description-wrap">
499
	<th><label for="description"><?php _e('Biographical Info'); ?></label></th>
500
	<td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea>
501
	<p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p></td>
502
</tr>
503
504
<?php if ( get_option( 'show_avatars' ) ) : ?>
505
<tr class="user-profile-picture">
506
	<th><?php _e( 'Profile Picture' ); ?></th>
507
	<td>
508
		<?php echo get_avatar( $user_id ); ?>
509
		<p class="description"><?php
510
			if ( IS_PROFILE_PAGE ) {
511
				/* translators: %s: Gravatar URL */
512
				$description = sprintf( __( 'You can change your profile picture on <a href="%s">Gravatar</a>.' ),
513
					__( 'https://en.gravatar.com/' )
514
				);
515
			} else {
516
				$description = '';
517
			}
518
519
			/**
520
			 * Filters the user profile picture description displayed under the Gravatar.
521
			 *
522
			 * @since 4.4.0
523
			 * @since 4.7.0 Added the `$profileuser` parameter.
524
			 *
525
			 * @param string  $description The description that will be printed.
526
			 * @param WP_User $profileuser The current WP_User object.
527
			 */
528
			echo apply_filters( 'user_profile_picture_description', $description, $profileuser );
529
		?></p>
530
	</td>
531
</tr>
532
<?php endif; ?>
533
534
<?php
535
/**
536
 * Filters the display of the password fields.
537
 *
538
 * @since 1.5.1
539
 * @since 2.8.0 Added the `$profileuser` parameter.
540
 * @since 4.4.0 Now evaluated only in user-edit.php.
541
 *
542
 * @param bool    $show        Whether to show the password fields. Default true.
543
 * @param WP_User $profileuser User object for the current user to edit.
544
 */
545
if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
546
?>
547
</table>
548
549
<h2><?php _e( 'Account Management' ); ?></h2>
550
<table class="form-table">
551
<tr id="password" class="user-pass1-wrap">
552
	<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
553
	<td>
554
		<input class="hidden" value=" " /><!-- #24364 workaround -->
555
		<button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Generate Password' ); ?></button>
556
		<div class="wp-pwd hide-if-js">
557
			<span class="password-input-wrapper">
558
				<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" />
559
			</span>
560
			<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
561
				<span class="dashicons dashicons-hidden"></span>
562
				<span class="text"><?php _e( 'Hide' ); ?></span>
563
			</button>
564
			<button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">
565
				<span class="text"><?php _e( 'Cancel' ); ?></span>
566
			</button>
567
			<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
568
		</div>
569
	</td>
570
</tr>
571
<tr class="user-pass2-wrap hide-if-js">
572
	<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
573
	<td>
574
	<input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" />
575
	<p class="description"><?php _e( 'Type your new password again.' ); ?></p>
576
	</td>
577
</tr>
578
<tr class="pw-weak">
579
	<th><?php _e( 'Confirm Password' ); ?></th>
580
	<td>
581
		<label>
582
			<input type="checkbox" name="pw_weak" class="pw-checkbox" />
583
			<span id="pw-weak-text-label"><?php _e( 'Confirm use of potentially weak password' ); ?></span>
584
		</label>
585
	</td>
586
</tr>
587
<?php endif; ?>
588
589
<?php
590
if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) : ?>
591
	<tr class="user-sessions-wrap hide-if-no-js">
592
		<th><?php _e( 'Sessions' ); ?></th>
593
		<td aria-live="assertive">
594
			<div class="destroy-sessions"><button type="button" disabled class="button"><?php _e( 'Log Out Everywhere Else' ); ?></button></div>
595
			<p class="description">
596
				<?php _e( 'You are only logged in at this location.' ); ?>
597
			</p>
598
		</td>
599
	</tr>
600
<?php elseif ( IS_PROFILE_PAGE && count( $sessions->get_all() ) > 1 ) : ?>
601
	<tr class="user-sessions-wrap hide-if-no-js">
602
		<th><?php _e( 'Sessions' ); ?></th>
603
		<td aria-live="assertive">
604
			<div class="destroy-sessions"><button type="button" class="button" id="destroy-sessions"><?php _e( 'Log Out Everywhere Else' ); ?></button></div>
605
			<p class="description">
606
				<?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.' ); ?>
607
			</p>
608
		</td>
609
	</tr>
610
<?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all() ) : ?>
611
	<tr class="user-sessions-wrap hide-if-no-js">
612
		<th><?php _e( 'Sessions' ); ?></th>
613
		<td>
614
			<p><button type="button" class="button" id="destroy-sessions"><?php _e( 'Log Out Everywhere' ); ?></button></p>
615
			<p class="description">
616
				<?php
617
				/* translators: 1: User's display name. */
618
				printf( __( 'Log %s out of all locations.' ), $profileuser->display_name );
619
				?>
620
			</p>
621
		</td>
622
	</tr>
623
<?php endif; ?>
624
625
</table>
626
627
<?php
628
	if ( IS_PROFILE_PAGE ) {
629
		/**
630
		 * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
631
		 *
632
		 * The action only fires if the current user is editing their own profile.
633
		 *
634
		 * @since 2.0.0
635
		 *
636
		 * @param WP_User $profileuser The current WP_User object.
637
		 */
638
		do_action( 'show_user_profile', $profileuser );
639
	} else {
640
		/**
641
		 * Fires after the 'About the User' settings table on the 'Edit User' screen.
642
		 *
643
		 * @since 2.0.0
644
		 *
645
		 * @param WP_User $profileuser The current WP_User object.
646
		 */
647
		do_action( 'edit_user_profile', $profileuser );
648
	}
649
?>
650
651
<?php
652
/**
653
 * Filters whether to display additional capabilities for the user.
654
 *
655
 * The 'Additional Capabilities' section will only be enabled if
656
 * the number of the user's capabilities exceeds their number of
657
 * roles.
658
 *
659
 * @since 2.8.0
660
 *
661
 * @param bool    $enable      Whether to display the capabilities. Default true.
662
 * @param WP_User $profileuser The current WP_User object.
663
 */
664
if ( count( $profileuser->caps ) > count( $profileuser->roles )
665
	&& apply_filters( 'additional_capabilities_display', true, $profileuser )
666
) : ?>
667
<h2><?php _e( 'Additional Capabilities' ); ?></h2>
668
<table class="form-table">
669
<tr class="user-capabilities-wrap">
670
	<th scope="row"><?php _e( 'Capabilities' ); ?></th>
671
	<td>
672
<?php
673
	$output = '';
674
	foreach ( $profileuser->caps as $cap => $value ) {
675
		if ( ! $wp_roles->is_role( $cap ) ) {
676
			if ( '' != $output )
677
				$output .= ', ';
678
			$output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
679
		}
680
	}
681
	echo $output;
682
?>
683
	</td>
684
</tr>
685
</table>
686
<?php endif; ?>
687
688
<input type="hidden" name="action" value="update" />
689
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
690
691
<?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
692
693
</form>
694
</div>
695
<?php
696
break;
697
}
698
?>
699
<script type="text/javascript">
700
	if (window.location.hash == '#password') {
701
		document.getElementById('pass1').focus();
702
	}
703
</script>
704
<?php
705
include( ABSPATH . 'wp-admin/admin-footer.php');
706