Make WordPress Core

Ticket #25383: user-edit.diff

File user-edit.diff, 22.5 KB (added by flabadab, 10 years ago)

User Profile Overhaul w/ Metaboxes

Line 
1<?php
2/**
3 * Edit user administration panel.
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/** WordPress Administration Bootstrap */
10require_once('./admin.php');
11
12wp_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) );
13
14if ( wp_is_mobile() )
15        wp_enqueue_script( 'jquery-touch-punch' );
16       
17
18$user_id = (int) $user_id;
19$current_user = wp_get_current_user();
20if ( ! defined( 'IS_PROFILE_PAGE' ) )
21        define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
22
23if ( ! $user_id && IS_PROFILE_PAGE )
24        $user_id = $current_user->ID;
25elseif ( ! $user_id && ! IS_PROFILE_PAGE )
26        wp_die(__( 'Invalid user ID.' ) );
27elseif ( ! get_userdata( $user_id ) )
28        wp_die( __('Invalid user ID.') );
29
30// Include post script for meta boxes (Hack)
31wp_enqueue_script('post');
32
33// Add media box scripts for images
34add_thickbox();
35wp_enqueue_media();
36
37
38wp_enqueue_script('user-profile');
39
40$title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
41if ( current_user_can('edit_users') && !IS_PROFILE_PAGE )
42        $submenu_file = 'users.php';
43else
44        $submenu_file = 'profile.php';
45
46if ( current_user_can('edit_users') && !is_user_admin() )
47        $parent_file = 'users.php';
48else
49        $parent_file = 'profile.php';
50
51$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        '<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        '<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>' .
54        '<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>' .
55        '<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>';
56
57get_current_screen()->add_help_tab( array(
58        'id'      => 'overview',
59        'title'   => __('Overview'),
60        'content' => $profile_help,
61) );
62
63get_current_screen()->set_help_sidebar(
64    '<p><strong>' . __('For more information:') . '</strong></p>' .
65    '<p>' . __('<a href="http://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' .
66    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
67);
68
69$wp_http_referer = remove_query_arg(array('update', 'delete_count'), $wp_http_referer );
70
71$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
72
73
74$profileuser = get_user_to_edit($user_id);
75
76/*
77**      Create User Update/Submit & Password Meta Box
78*/
79
80function user_submit_meta_box( $user_id ) {
81        global $action;
82       
83        $user = get_userdata($user_id);
84?>
85
86<div id="submituser">
87        <div id="minor-publishing">
88                <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
89                <div style="display:none;">
90                        <?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
91                </div>
92                <div id="misc-publishing-actions">
93                        <?php
94        // translators: Publish box date format, see http://php.net/date
95        $datef = __( 'M j, Y @ G:i' );
96        $stamp = __('Added on: <b>%1$s</b>');
97        $date = date_i18n( $datef, strtotime( $user->user_registered ) );
98        ?>
99                        <div class="misc-pub-section curtime"> <span id="timestamp"><?php printf($stamp, $date); ?></span> </div>
100                        <!-- .misc-pub-section -->
101                </div>
102                <!-- #misc-publishing-actions -->
103                <div class="clear"></div>
104        </div>
105        <!-- #minor-publishing -->
106       
107        <div id="major-publishing-actions">
108                <?php
109$show_password_fields = apply_filters('show_password_fields', true, $profileuser);
110if ( $show_password_fields ) :
111?>
112                <div class="pass-fields">
113                        <label for="pass1">
114                                <?php _e('New Password'); ?>
115                        </label>
116                        <br />
117                        <input class="hidden" value=" " />
118                        <!-- #24364 workaround -->
119                        <input style="text-align:left;" type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" />
120                        <div class="clear"></div>
121                        <label for="pass2">
122                                <?php _e('Repeat New Password'); ?>
123                        </label>
124                        <br />
125                        <input style="text-align:left;" name="pass2" type="password" id="pass2" size="16" value="" autocomplete="off" />
126                        <br />
127                        <div id="pass-strength-result">
128                                <?php _e('Strength indicator'); ?>
129                        </div>
130                </div>
131                <?php endif; ?>
132                <div id="delete-action">
133                        <?php
134        if ( current_user_can( 'delete_users', $user_id) ){
135                        echo "<a class='submitdelete deletion' href='" . wp_nonce_url(admin_url(). 'users.php?user='. $user_id, 'bulk-users','action=delete&_wpnonce') . "'>" . __( 'Delete User' ) . "</a>";
136        }
137        ?>
138                </div>
139                <div id="publishing-action"> <span class="spinner"></span>
140                        <input type="hidden" name="action" value="update" />
141                        <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
142                        <?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
143                </div>
144                <div class="clear"></div>
145        </div>
146        <!-- #major-publishing-actions -->
147       
148</div>
149<?php
150}
151
152/*
153**      Create User Personal Options Meta Box
154*/
155
156function user_personal_options_meta_box( $user_id ) {
157global $_wp_admin_css_colors,$profileuser; ?>
158<table class="form-table">
159        <?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?>
160        <tr>
161                <th scope="row"><?php _e('Visual Editor')?></th>
162                <td><label for="rich_editing">
163                                <input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked('false', $profileuser->rich_editing); ?> />
164                                <?php _e('Disable the visual editor when writing'); ?>
165                        </label></td>
166        </tr>
167        <?php endif; ?>
168        <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
169        <tr>
170                <th scope="row"><?php _e('Admin Color Scheme')?></th>
171                <td><?php do_action( 'admin_color_scheme_picker' ); ?></td>
172        </tr>
173        <?php
174endif; // $_wp_admin_css_colors
175if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
176        <tr>
177                <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
178                <td><label for="comment_shortcuts">
179                                <input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> />
180                                <?php _e('Enable keyboard shortcuts for comment moderation.'); ?>
181                        </label>
182                        <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
183        </tr>
184        <?php endif; ?>
185        <tr class="show-admin-bar">
186                <th scope="row"><?php _e('Toolbar')?></th>
187                <td><fieldset>
188                                <legend class="screen-reader-text"><span>
189                                <?php _e('Toolbar') ?>
190                                </span></legend>
191                                <label for="admin_bar_front">
192                                        <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
193                                        <?php _e( 'Show Toolbar when viewing site' ); ?>
194                                </label>
195                                <br />
196                        </fieldset></td>
197        </tr>
198        <?php do_action('personal_options', $profileuser); ?>
199</table>
200<?php
201        if ( IS_PROFILE_PAGE )
202                do_action('profile_personal_options', $profileuser);
203?>
204<?php
205}
206
207/*
208**      Create User Name Meta Box
209*/
210
211function user_name_meta_box( $user_id ) {
212global $profileuser;?>
213<table class="form-table">
214        <tr>
215                <th><label for="user_login">
216                                <?php _e('Username'); ?>
217                        </label></th>
218                <td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" />
219                        <span class="description">
220                        <?php _e('Usernames cannot be changed.'); ?>
221                        </span></td>
222        </tr>
223        <?php
224
225 if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?>
226        <tr>
227                <th><label for="role">
228                                <?php _e('Role') ?>
229                        </label></th>
230                <td><select name="role" id="role">
231                                <?php
232// Compare user role against currently editable roles
233$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
234$user_role  = array_shift( $user_roles );
235
236// print the full list of roles with the primary one selected.
237wp_dropdown_roles($user_role);
238
239// print the 'no role' option. Make it selected if the user has no role yet.
240if ( $user_role )
241        echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
242else
243        echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
244?>
245                        </select></td>
246        </tr>
247        <?php endif; //!IS_PROFILE_PAGE
248
249if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
250        <tr>
251                <th><?php _e('Super Admin'); ?></th>
252                <td><?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
253                        <p>
254                                <label>
255                                        <input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> />
256                                        <?php _e( 'Grant this user super admin privileges for the Network.' ); ?>
257                                </label>
258                        </p>
259                        <?php else : ?>
260                        <p>
261                                <?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?>
262                        </p>
263                        <?php endif; ?></td>
264        </tr>
265        <?php } ?>
266        <tr>
267                <th><label for="first_name">
268                                <?php _e('First Name') ?>
269                        </label></th>
270                <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
271        </tr>
272        <tr>
273                <th><label for="last_name">
274                                <?php _e('Last Name') ?>
275                        </label></th>
276                <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
277        </tr>
278        <tr>
279                <th><label for="nickname">
280                                <?php _e('Nickname'); ?>
281                                <span class="description">
282                                <?php _e('(required)'); ?>
283                                </span></label></th>
284                <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td>
285        </tr>
286        <?php
287       
288        /*
289        **      Create action hook to add more user detail fields
290        */
291       
292        do_action( 'additional_user_details', $profileuser);
293        ?>
294        <tr>
295                <th><label for="display_name">
296                                <?php _e('Display name publicly as') ?>
297                        </label></th>
298                <td><select name="display_name" id="display_name">
299                                <?php
300                        $public_display = array();
301                        $public_display['display_nickname']  = $profileuser->nickname;
302                        $public_display['display_username']  = $profileuser->user_login;
303
304                        if ( !empty($profileuser->first_name) )
305                                $public_display['display_firstname'] = $profileuser->first_name;
306
307                        if ( !empty($profileuser->last_name) )
308                                $public_display['display_lastname'] = $profileuser->last_name;
309
310                        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
311                                $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
312                                $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
313                        }
314
315                        if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
316                                $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
317
318                        $public_display = array_map( 'trim', $public_display );
319                        $public_display = array_unique( $public_display );
320
321                        foreach ( $public_display as $id => $item ) {
322                ?>
323                                <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
324                                <?php
325                        }
326                ?>
327                        </select></td>
328        </tr>
329</table>
330<?php
331}
332       
333/*
334**      Create User Contact Meta Box
335*/
336
337function user_contact_meta_box( $user_id ){
338global $profileuser; ?>
339<table class="form-table">
340        <tr>
341                <th><label for="email">
342                                <?php _e('E-mail'); ?>
343                                <span class="description">
344                                <?php _e('(required)'); ?>
345                                </span></label></th>
346                <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" />
347                        <?php
348        $new_email = get_option( $current_user->ID . '_new_email' );
349        if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
350                        <div class="updated inline">
351                                <p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
352                        </div>
353                        <?php endif; ?></td>
354        </tr>
355        <tr>
356                <th><label for="url">
357                                <?php _e('Website') ?>
358                        </label></th>
359                <td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
360        </tr>
361        <?php
362        foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
363?>
364        <tr>
365                <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
366                <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
367        </tr>
368        <?php
369        }
370?>
371</table>
372<?php
373       
374        /*
375        **      Create action hook to add more user contact options (i.e. Address)
376        */
377       
378        do_action( 'additional_contact_methods', $profileuser);
379}
380
381
382/*
383**      Create User Bio Meta Box
384*/
385
386function user_bio_meta_box( $user_id ){
387global $profileuser; ?>
388<table class="form-table">
389        <tr>
390                <th><label for="description">
391                                <?php _e('Biographical Info'); ?>
392                        </label></th>
393                <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea>
394                        <br />
395                        <span class="description">
396                        <?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?>
397                        </span></td>
398        </tr>
399</table>
400<?php   
401}
402
403/**
404 * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
405 *
406 * @since 2.7.0
407 *
408 * @param object $user User data object
409 */
410function use_ssl_preference($user) {
411?>
412<tr>
413        <th scope="row"><?php _e('Use https')?></th>
414        <td><label for="use_ssl">
415                        <input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> />
416                        <?php _e('Always use https when visiting the admin'); ?>
417                </label></td>
418</tr>
419<?php
420}
421
422// Only allow super admins on multisite to edit every user.
423if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
424        wp_die( __( 'You do not have permission to edit this user.' ) );
425
426// Execute confirmed email change. See send_confirmation_on_profile_email().
427if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
428        $new_email = get_option( $current_user->ID . '_new_email' );
429        if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
430                $user = new stdClass;
431                $user->ID = $current_user->ID;
432                $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
433                if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
434                        $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
435                wp_update_user( $user );
436                delete_option( $current_user->ID . '_new_email' );
437                wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
438                die();
439        }
440} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
441        delete_option( $current_user->ID . '_new_email' );
442        wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
443        die();
444}
445
446switch ($action) {
447case 'update':
448
449check_admin_referer('update-user_' . $user_id);
450
451if ( !current_user_can('edit_user', $user_id) )
452        wp_die(__('You do not have permission to edit this user.'));
453
454if ( IS_PROFILE_PAGE )
455        do_action('personal_options_update', $user_id);
456else
457        do_action('edit_user_profile_update', $user_id);
458
459if ( !is_multisite() ) {
460        $errors = edit_user($user_id);
461} else {
462        $user = get_userdata( $user_id );
463
464        // Update the email address in signups, if present.
465        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 ) ) )
466                $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) );
467
468        // WPMU must delete the user from the current blog if WP added him after editing.
469        $delete_role = false;
470        $blog_prefix = $wpdb->get_blog_prefix();
471        if ( $user_id != $current_user->ID ) {
472                $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
473                if ( !is_network_admin() && null == $cap && $_POST[ 'role' ] == '' ) {
474                        $_POST[ 'role' ] = 'contributor';
475                        $delete_role = true;
476                }
477        }
478        if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) )
479                $errors = edit_user($user_id);
480        if ( $delete_role ) // stops users being added to current blog when they are edited
481                delete_user_meta( $user_id, $blog_prefix . 'capabilities' );
482
483        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 ) )
484                empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
485}
486
487if ( !is_wp_error( $errors ) ) {
488        $redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
489        if ( $wp_http_referer )
490                $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
491        wp_redirect($redirect);
492        exit;
493}
494
495default:
496$profileuser = get_user_to_edit($user_id);
497
498if ( !current_user_can('edit_user', $user_id) )
499        wp_die(__('You do not have permission to edit this user.'));
500
501include (ABSPATH . 'wp-admin/admin-header.php');
502
503/*
504**      Display User Meta Boxes
505*/
506
507require_once(ABSPATH . 'wp-admin/includes/meta-boxes.php');
508
509add_meta_box( 'updatediv', __('Save'), 'user_submit_meta_box', null, 'side', 'core' );
510add_meta_box( 'personaldiv', __('Personal Options'), 'user_personal_options_meta_box', null, 'normal', 'core' );
511add_meta_box( 'namediv', __('Name'), 'user_name_meta_box', null, 'normal', 'core' );
512add_meta_box( 'contactdiv', __('Contact Info'), 'user_contact_meta_box', null, 'normal', 'core' );
513add_meta_box( 'biodiv', IS_PROFILE_PAGE ? __('About Yourself') : __('About the user'), 'user_bio_meta_box', null, 'normal', 'core' );
514
515
516if ( count( $profileuser->caps ) > count( $profileuser->roles ) && apply_filters( 'additional_capabilities_display', true, $profileuser ) ) :
517        add_meta_box( 'addcapdiv', __('Additional Capabilities'), 'user_additional_capabilities_meta_box', null, 'normal', 'core' );
518endif;
519
520if ( IS_PROFILE_PAGE )
521        do_action( 'show_user_profile', $profileuser );
522else
523        do_action( 'edit_user_profile', $profileuser );
524
525add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
526?>
527<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
528<div class="updated">
529        <p><strong>
530                <?php _e('Important:'); ?>
531                </strong>
532                <?php _e('This user has super admin privileges.'); ?>
533        </p>
534</div>
535<?php } ?>
536<div class="wrap" id="profile-page">
537        <?php screen_icon(); ?>
538        <h2>
539                <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
540                <div class="error">
541                        <p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p>
542                </div>
543                <?php endif; ?>
544                <?php if ( isset($_GET['updated']) ) : ?>
545                <div id="message" class="updated">
546                        <?php if ( IS_PROFILE_PAGE ) : ?>
547                        <p><strong>
548                                <?php _e('Profile updated.') ?>
549                                </strong></p>
550                        <?php else: ?>
551                        <p><strong>
552                                <?php _e('User updated.') ?>
553                                </strong></p>
554                        <?php endif; ?>
555                        <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
556                        <p><a href="<?php echo esc_url( $wp_http_referer ); ?>">
557                                <?php _e('&larr; Back to Users'); ?>
558                                </a></p>
559                        <?php endif; ?>
560                </div>
561                <?php endif; ?>
562                <?php
563echo esc_html( $title );
564if ( ! IS_PROFILE_PAGE ) {
565        if ( current_user_can( 'create_users' ) ) { ?>
566                <a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
567                <?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
568                <a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
569                <?php }
570} ?>
571        </h2>
572        <form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>>
573                <?php
574                                wp_nonce_field('update-user_' . $user_id);
575                                wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
576                                wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
577                <?php if ( $wp_http_referer ) : ?>
578                <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
579                <?php endif; ?>
580                <p>
581                        <input type="hidden" name="from" value="profile" />
582                        <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
583                </p>
584                <div id="poststuff">
585                <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
586                        <div id="post-body-content">
587                                <div id="postbox-container-1" class="postbox-container">
588                                        <?php
589                                                do_meta_boxes( null, 'side', $user_id );
590                                        ?>
591                                </div>
592                                <div id="postbox-container-2" class="postbox-container">
593                                        <?php
594                                                do_meta_boxes(null, 'normal', $user_id);
595                                       
596                                                do_meta_boxes(null, 'advanced', $user_id);
597                                        ?>
598                                </div>
599                        </div>
600                        <!-- /post-body -->
601                        <br class="clear" />
602                </div>
603                <!-- /poststuff -->
604        </form>
605</div>
606</form>
607</div>
608<?php
609break;
610}
611?>
612<script type="text/javascript">
613        if (window.location.hash == '#password') {
614                document.getElementById('pass1').focus();
615        }
616</script>
617<?php
618include( ABSPATH . 'wp-admin/admin-footer.php');