Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 406 lines (348 sloc) 17.445 kB
48ac42c Added ability to edit other users.
saxmatt authored
1 <?php
c19b2d7 More phpdoc updates for wp-adming. See #7496 props santosj.
westi authored
2 /**
3 * Edit user administration panel.
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
8
c19b2d7 More phpdoc updates for wp-adming. See #7496 props santosj.
westi authored
9 /** WordPress Administration Bootstrap */
6ec7cb4 Use relative paths when including files, avoiding include_path. fixes…
nacin authored
10 require_once('./admin.php');
48ac42c Added ability to edit other users.
saxmatt authored
11
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
12 wp_reset_vars(array('action', 'redirect', 'profile', '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.') );
7db4c0a Fix profile submenu highlight. Make is_profile_page a constant so th…
ryan authored
25
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
26 wp_enqueue_script('user-profile');
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
27
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
28 $title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
29 if ( current_user_can('edit_users') && !IS_PROFILE_PAGE )
7db4c0a Fix profile submenu highlight. Make is_profile_page a constant so th…
ryan authored
30 $submenu_file = 'users.php';
eda9021 Hold off on menu cleanup until next release. There be dragons.
ryan authored
31 else
7db4c0a Fix profile submenu highlight. Make is_profile_page a constant so th…
ryan authored
32 $submenu_file = 'profile.php';
9c31fd7 First pass of user admin. Network admin and screen cleanups. see #14696
ryan authored
33
34 if ( current_user_can('edit_users') && !is_user_admin() )
35 $parent_file = 'users.php';
36 else
37 $parent_file = 'profile.php';
48ac42c Added ability to edit other users.
saxmatt authored
38
720667d Users help. props dragoonis. see #13467.
nacin authored
39 // contextual help - choose Help on the top right of admin panel to preview this.
40 add_contextual_help($current_screen,
08334ae Entities cleanup for help. Props zeo. see #13467
ryan authored
41 '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
17129fb Cut 'em out, move 'em on, trailing whitespace
ryan authored
42 '<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.') . '</p>' .
720667d Users help. props dragoonis. see #13467.
nacin authored
43 '<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>' .
44 '<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>' .
17129fb Cut 'em out, move 'em on, trailing whitespace
ryan authored
45 '<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>' .
46 '<p><strong>' . __('For more information:') . '</strong></p>' .
6c7120f target=blank help fixes. props zeo, fixes #13467.
nacin authored
47 '<p>' . __('<a href="http://codex.wordpress.org/Users_Your_Profile_SubPanel" target="_blank">Documentation on User Profiles</a>') . '</p>' .
48 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
720667d Users help. props dragoonis. see #13467.
nacin authored
49 );
50
51
5e7c850 User management improvements from Mark Jaquith and David House. #2793
ryan authored
52 $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
53
00f547c Fix notice. Props wnorris. fixes #8433
ryan authored
54 $all_post_caps = array('posts', 'pages');
8a6eacd Hide options from users when they don't make any sense for them. Fixe…
westi authored
55 $user_can_edit = false;
00f547c Fix notice. Props wnorris. fixes #8433
ryan authored
56 foreach ( $all_post_caps as $post_cap )
57 $user_can_edit |= current_user_can("edit_$post_cap");
8a6eacd Hide options from users when they don't make any sense for them. Fixe…
westi authored
58
9ce46d3 phpdoc for wp-admin. Props jacobsantos. see #7527
ryan authored
59 /**
60 * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
61 *
62 * @since 2.7.0
63 *
64 * @param object $user User data object
65 */
203086a Option to force SSL. see #7561
ryan authored
66 function use_ssl_preference($user) {
67 ?>
68 <tr>
69 <th scope="row"><?php _e('Use https')?></th>
70 <td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> /> <?php _e('Always use https when visiting the admin'); ?></label></td>
71 </tr>
72 <?php
73 }
37d767a Don't show user form without privs. Props westi. fixes #3142
ryan authored
74
9d2762f merge wp-admin user, plugins, themes, upgrade , See #11644
wpmuguru authored
75
8b87777 Switch the multisite constant EDIT_ANY_USER to a filter. Also ensure …
nacin authored
76 // Only allow super admins on multisite to edit every user.
e439ce1 more manage_network_* caps, see #12109
wpmuguru authored
77 if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
6da55f7 Trailing whitespace cleanup
ryan authored
78 wp_die( __( 'You do not have permission to edit this user.' ) );
79
8caab55 Integrate update_profile_email() into user-edit.php. see #11644
ryan authored
80 // Execute confirmed email change. See send_confirmation_on_profile_email().
81 if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
82 $new_email = get_option( $current_user->ID . '_new_email' );
83 if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
84 $user->ID = $current_user->ID;
b4f3622 Don't use deprecated functions. see #11388
nacin authored
85 $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
8caab55 Integrate update_profile_email() into user-edit.php. see #11644
ryan authored
86 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
87 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
88 wp_update_user( get_object_vars( $user ) );
89 delete_option( $current_user->ID . '_new_email' );
21e3f0f Network Admin, first pass. see #14435
ryan authored
90 wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
8caab55 Integrate update_profile_email() into user-edit.php. see #11644
ryan authored
91 die();
92 }
6fa00b3 Allow users to cancel email address changes. Fixes #13457 props mtdew…
westi authored
93 } elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
94 delete_option( $current_user->ID . '_new_email' );
21e3f0f Network Admin, first pass. see #14435
ryan authored
95 wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
6fa00b3 Allow users to cancel email address changes. Fixes #13457 props mtdew…
westi authored
96 die();
8caab55 Integrate update_profile_email() into user-edit.php. see #11644
ryan authored
97 }
98
48ac42c Added ability to edit other users.
saxmatt authored
99 switch ($action) {
7af3616 Roles update + UI from Owen.
ryan authored
100 case 'switchposts':
101
102 check_admin_referer();
103
104 /* TODO: Switch all posts from one user to another user */
105
106 break;
107
48ac42c Added ability to edit other users.
saxmatt authored
108 case 'update':
109
96c3f73 Update nonce action strings. Props mdawaffe.
ryan authored
110 check_admin_referer('update-user_' . $user_id);
c3170f0 Check admin referer.
ryan authored
111
dac809b Add more fine grained user management caps. Part 1. #2775
ryan authored
112 if ( !current_user_can('edit_user', $user_id) )
37d767a Don't show user form without privs. Props westi. fixes #3142
ryan authored
113 wp_die(__('You do not have permission to edit this user.'));
114
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
115 if ( IS_PROFILE_PAGE )
def8fb6 Pass user to actions. Props sirzooro. fixes #9795
ryan authored
116 do_action('personal_options_update', $user_id);
4fbc458 Fire an action to allow extra Profile fields to be processed. Fixes #…
westi authored
117 else
def8fb6 Pass user to actions. Props sirzooro. fixes #9795
ryan authored
118 do_action('edit_user_profile_update', $user_id);
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
119
9d2762f merge wp-admin user, plugins, themes, upgrade , See #11644
wpmuguru authored
120 if ( !is_multisite() ) {
121 $errors = edit_user($user_id);
122 } else {
3890930 Move update_signup_email_from_profile() logic into user-edit.php. see…
ryan authored
123 $user = get_userdata( $user_id );
124
125 // Update the email address in signups, if present.
126 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 ) ) )
127 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) );
128
9d2762f merge wp-admin user, plugins, themes, upgrade , See #11644
wpmuguru authored
129 // WPMU must delete the user from the current blog if WP added him after editing.
130 $delete_role = false;
131 $blog_prefix = $wpdb->get_blog_prefix();
8760e7d Coding standards, space after if
ryan authored
132 if ( $user_id != $current_user->ID ) {
9d2762f merge wp-admin user, plugins, themes, upgrade , See #11644
wpmuguru authored
133 $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:{}'" );
8760e7d Coding standards, space after if
ryan authored
134 if ( null == $cap && $_POST[ 'role' ] == '' ) {
9d2762f merge wp-admin user, plugins, themes, upgrade , See #11644
wpmuguru authored
135 $_POST[ 'role' ] = 'contributor';
136 $delete_role = true;
137 }
138 }
139 if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) )
140 $errors = edit_user($user_id);
8760e7d Coding standards, space after if
ryan authored
141 if ( $delete_role ) // stops users being added to current blog when they are edited
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
142 delete_user_meta( $user_id, $blog_prefix . 'capabilities' );
143
21e3f0f Network Admin, first pass. see #14435
ryan authored
144 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 ) )
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
145 empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
9d2762f merge wp-admin user, plugins, themes, upgrade , See #11644
wpmuguru authored
146 }
7af3616 Roles update + UI from Owen.
ryan authored
147
203086a Option to force SSL. see #7561
ryan authored
148 if ( !is_wp_error( $errors ) ) {
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
149 $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
5e7c850 User management improvements from Mark Jaquith and David House. #2793
ryan authored
150 $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
ff19f4b Use wp_redirect().
ryan authored
151 wp_redirect($redirect);
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
152 exit;
7af3616 Roles update + UI from Owen.
ryan authored
153 }
48ac42c Added ability to edit other users.
saxmatt authored
154
155 default:
207d876 Make those chars feel special.
ryan authored
156 $profileuser = get_user_to_edit($user_id);
48ac42c Added ability to edit other users.
saxmatt authored
157
dac809b Add more fine grained user management caps. Part 1. #2775
ryan authored
158 if ( !current_user_can('edit_user', $user_id) )
203086a Option to force SSL. see #7561
ryan authored
159 wp_die(__('You do not have permission to edit this user.'));
37d767a Don't show user form without privs. Props westi. fixes #3142
ryan authored
160
21e3f0f Network Admin, first pass. see #14435
ryan authored
161 include (ABSPATH . 'wp-admin/admin-header.php');
48ac42c Added ability to edit other users.
saxmatt authored
162 ?>
163
e439ce1 more manage_network_* caps, see #12109
wpmuguru authored
164 <?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
165 <div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
166 <?php } ?>
ee2e45f Save user profile. Bug 413.
rboren authored
167 <?php if ( isset($_GET['updated']) ) : ?>
4134133 Remove unused .fade CSS class, props nacin, fixes #11628
azaozz authored
168 <div id="message" class="updated">
48ac42c Added ability to edit other users.
saxmatt authored
169 <p><strong><?php _e('User updated.') ?></strong></p>
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
170 <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
cf33330 Page link styling improvements. Props iammattthomas. fixes #8266
ryan authored
171 <p><a href="users.php"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
5e7c850 User management improvements from Mark Jaquith and David House. #2793
ryan authored
172 <?php endif; ?>
48ac42c Added ability to edit other users.
saxmatt authored
173 </div>
174 <?php endif; ?>
95e2623 Notice fixes see #7509 props DD32 and jacobsantos.
westi authored
175 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
e40572b Some default password nag and user-edit div.error style cleanups.
nacin authored
176 <div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
7af3616 Roles update + UI from Owen.
ryan authored
177 <?php endif; ?>
48ac42c Added ability to edit other users.
saxmatt authored
178
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
179 <div class="wrap" id="profile-page">
7c68e69 Screen icons
azaozz authored
180 <?php screen_icon(); ?>
119b39c deprecate wp_specialchars() in favor of esc_html(). Encode quotes for…
markjaquith authored
181 <h2><?php echo esc_html( $title ); ?></h2>
7af3616 Roles update + UI from Owen.
ryan authored
182
21e3f0f Network Admin, first pass. see #14435
ryan authored
183 <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'); ?>>
8ea8979 Edit profile nonce fix from markjaquith. fixes #2776
ryan authored
184 <?php wp_nonce_field('update-user_' . $user_id) ?>
5e7c850 User management improvements from Mark Jaquith and David House. #2793
ryan authored
185 <?php if ( $wp_http_referer ) : ?>
3ebf837 Deprecate sanitize_url() and clean_url() in favor of esc_url_raw() an…
markjaquith authored
186 <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
5e7c850 User management improvements from Mark Jaquith and David House. #2793
ryan authored
187 <?php endif; ?>
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
188 <p>
189 <input type="hidden" name="from" value="profile" />
190 <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
191 </p>
192
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
193 <h3><?php _e('Personal Options'); ?></h3>
194
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
195 <table class="form-table">
8a6eacd Hide options from users when they don't make any sense for them. Fixe…
westi authored
196 <?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
197 <tr>
f0479db Admin color selector. see #6167
ryan authored
198 <th scope="row"><?php _e('Visual Editor')?></th>
6666636 Turn the Visual Editor user preference on its head, to more accuratel…
markjaquith authored
199 <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked('false', $profileuser->rich_editing); ?> /> <?php _e('Disable the visual editor when writing'); ?></label></td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
200 </tr>
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
201 <?php endif; ?>
b1621c6 Move Admin Colour Scheme picker to a hook. Props Jick. s/register_adm…
dd32 authored
202 <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
f0479db Admin color selector. see #6167
ryan authored
203 <tr>
204 <th scope="row"><?php _e('Admin Color Scheme')?></th>
b1621c6 Move Admin Colour Scheme picker to a hook. Props Jick. s/register_adm…
dd32 authored
205 <td><?php do_action( 'admin_color_scheme_picker' ); ?></td>
399da81 user edit form validation fixes
ryan authored
206 </tr>
c97d7d3 Fix nesting of an if statement. Show keyboard shortcuts option even w…
nacin authored
207 <?php
b1621c6 Move Admin Colour Scheme picker to a hook. Props Jick. s/register_adm…
dd32 authored
208 endif; // $_wp_admin_css_colors
c97d7d3 Fix nesting of an if statement. Show keyboard shortcuts option even w…
nacin authored
209 if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
ae2c4bc Add opt-in optioon for comment hotkeys. Props nbachiyski. fixes #7643
ryan authored
210 <tr>
211 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
52e8680 CSS fix for vertical misalignment in user-edit.php, props demetris, f…
azaozz authored
212 <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="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>'); ?></td>
ae2c4bc Add opt-in optioon for comment hotkeys. Props nbachiyski. fixes #7643
ryan authored
213 </tr>
203086a Option to force SSL. see #7561
ryan authored
214 <?php
215 endif;
216 do_action('personal_options', $profileuser);
217 ?>
f0479db Admin color selector. see #6167
ryan authored
218 </table>
9cb8894 Move the endif inside the table so [8461] doesn't break the html. Fix…
westi authored
219 <?php
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
220 if ( IS_PROFILE_PAGE )
203086a Option to force SSL. see #7561
ryan authored
221 do_action('profile_personal_options', $profileuser);
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
222 ?>
5160c44 Add rich editing checkbox to user-edit so that the setting isn't stom…
ryan authored
223
eab1b66 gettext
ryan authored
224 <h3><?php _e('Name') ?></h3>
5160c44 Add rich editing checkbox to user-edit so that the setting isn't stom…
ryan authored
225
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
226 <table class="form-table">
227 <tr>
7733c94 Validation and Translation fixes for the Profile page. Fixes #6152 an…
westi authored
228 <th><label for="user_login"><?php _e('Username'); ?></label></th>
eb709de Use a generic string instead of "Your username" in user-edit.php to a…
nacin authored
229 <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>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
230 </tr>
a8b6fe2 Show Role in profile and user edit. Don't allow users with edit_user…
ryan authored
231
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
232 <?php if ( !IS_PROFILE_PAGE ): ?>
7733c94 Validation and Translation fixes for the Profile page. Fixes #6152 an…
westi authored
233 <tr><th><label for="role"><?php _e('Role:') ?></label></th>
0277488 use wp_dropdown_roles(). Props jeremyclarke. fixes #8764
ryan authored
234 <td><select name="role" id="role">
a8b6fe2 Show Role in profile and user edit. Don't allow users with edit_user…
ryan authored
235 <?php
0277488 use wp_dropdown_roles(). Props jeremyclarke. fixes #8764
ryan authored
236 // Get the highest/primary role for this user
237 // TODO: create a function that does this: wp_get_user_role()
238 $user_roles = $profileuser->roles;
239 $user_role = array_shift($user_roles);
240
241 // print the full list of roles with the primary one selected.
242 wp_dropdown_roles($user_role);
243
244 // print the 'no role' option. Make it selected if the user has no role yet.
245 if ( $user_role )
e64a657 s/blog/site/ in even more places. props PeteMall, see #11644.
nacin authored
246 echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
8310e71 Better handling of users with no role. Props Mark Jaquith. #2809
ryan authored
247 else
e64a657 s/blog/site/ in even more places. props PeteMall, see #11644.
nacin authored
248 echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
67bf900 Fix notice. Props jeremyclarke. see #8764
ryan authored
249 ?>
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
250 </select>
21e3f0f Network Admin, first pass. see #14435
ryan authored
251 <?php if ( is_multisite() && is_network_admin() && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
252 <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>
253 <?php } ?>
254 </td></tr>
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
255 <?php endif; //!IS_PROFILE_PAGE ?>
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
256
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
257 <tr>
9485983 i18n fixes. Props nbachiyski. fixes #11954
ryan authored
258 <th><label for="first_name"><?php _e('First Name') ?></label></th>
6c2ffdd _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_at…
markjaquith authored
259 <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
260 </tr>
261
262 <tr>
9485983 i18n fixes. Props nbachiyski. fixes #11954
ryan authored
263 <th><label for="last_name"><?php _e('Last Name') ?></label></th>
6c2ffdd _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_at…
markjaquith authored
264 <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
265 </tr>
266
267 <tr>
fc48817 Don't display empty values in the user display name drop-down, props …
azaozz authored
268 <th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
6c2ffdd _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_at…
markjaquith authored
269 <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
270 </tr>
271
272 <tr>
fc48817 Don't display empty values in the user display name drop-down, props …
azaozz authored
273 <th><label for="display_name"><?php _e('Display name publicly as') ?></label></th>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
274 <td>
7733c94 Validation and Translation fixes for the Profile page. Fixes #6152 an…
westi authored
275 <select name="display_name" id="display_name">
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
276 <?php
277 $public_display = array();
e072616 Dynamically update display name as its components are updated in the …
markjaquith authored
278 $public_display['display_username'] = $profileuser->user_login;
30b8214 Dynamically remove duplicates from the 'display name' profile.php opt…
nacin authored
279 $public_display['display_nickname'] = $profileuser->nickname;
fc48817 Don't display empty values in the user display name drop-down, props …
azaozz authored
280 if ( !empty($profileuser->first_name) )
281 $public_display['display_firstname'] = $profileuser->first_name;
282 if ( !empty($profileuser->last_name) )
283 $public_display['display_lastname'] = $profileuser->last_name;
284 if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
285 $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
286 $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
287 }
30b8214 Dynamically remove duplicates from the 'display name' profile.php opt…
nacin authored
288 if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
e072616 Dynamically update display name as its components are updated in the …
markjaquith authored
289 $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
290 $public_display = array_map( 'trim', $public_display );
30b8214 Dynamically remove duplicates from the 'display name' profile.php opt…
nacin authored
291 $public_display = array_unique( $public_display );
e072616 Dynamically update display name as its components are updated in the …
markjaquith authored
292 foreach ( $public_display as $id => $item ) {
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
293 ?>
6c2ffdd _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_at…
markjaquith authored
294 <option id="<?php echo $id; ?>" value="<?php echo esc_attr($item); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
295 <?php
296 }
297 ?>
298 </select>
299 </td>
300 </tr>
301 </table>
302
eab1b66 gettext
ryan authored
303 <h3><?php _e('Contact Info') ?></h3>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
304
305 <table class="form-table">
306 <tr>
fc48817 Don't display empty values in the user display name drop-down, props …
azaozz authored
307 <th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
6fa00b3 Allow users to cancel email address changes. Fixes #13457 props mtdew…
westi authored
308 <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" />
309 <?php
310 $new_email = get_option( $current_user->ID . '_new_email' );
311 if ( $new_email && $new_email != $current_user->user_email ) : ?>
312 <div class="updated inline">
21e3f0f Network Admin, first pass. see #14435
ryan authored
313 <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>
6fa00b3 Allow users to cancel email address changes. Fixes #13457 props mtdew…
westi authored
314 </div>
315 <?php endif; ?>
316 </td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
317 </tr>
318
319 <tr>
7733c94 Validation and Translation fixes for the Profile page. Fixes #6152 an…
westi authored
320 <th><label for="url"><?php _e('Website') ?></label></th>
6c2ffdd _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_at…
markjaquith authored
321 <td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
399da81 user edit form validation fixes
ryan authored
322 </tr>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
323
8aa2598 Make it much easier to filter contact methods from user profiles addi…
westi authored
324 <?php
325 foreach (_wp_get_user_contactmethods() as $name => $desc) {
326 ?>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
327 <tr>
8aa2598 Make it much easier to filter contact methods from user profiles addi…
westi authored
328 <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
329 <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
8e3808b Remove trailing whitespace
ryan authored
330 </tr>
8aa2598 Make it much easier to filter contact methods from user profiles addi…
westi authored
331 <?php
332 }
333 ?>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
334 </table>
335
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
336 <h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
337
338 <table class="form-table">
339 <tr>
7733c94 Validation and Translation fixes for the Profile page. Fixes #6152 an…
westi authored
340 <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
aa1e377 Filter fields through kses upon display. Introduce sanitize_user_obje…
ryan authored
341 <td><textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html($profileuser->description); ?></textarea><br />
fc48817 Don't display empty values in the user display name drop-down, props …
azaozz authored
342 <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
343 </tr>
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
344
345 <?php
def8fb6 Pass user to actions. Props sirzooro. fixes #9795
ryan authored
346 $show_password_fields = apply_filters('show_password_fields', true, $profileuser);
53eef6d Allowing more hooks into authentication - Hat tip: http://dev.webadmi…
matt authored
347 if ( $show_password_fields ) :
348 ?>
614244a Add a nag message if the user is still using an auto-generated passwo…
westi authored
349 <tr id="password">
36617f1 Remove colons from field names. Props thee17. fixes #7158
ryan authored
350 <th><label for="pass1"><?php _e('New Password'); ?></label></th>
fc48817 Don't display empty values in the user display name drop-down, props …
azaozz authored
351 <td><input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?></span><br />
352 <input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("Type your new password again."); ?></span><br />
08df160 New colors and small improvements for the pwd strength meter, include…
azaozz authored
353 <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
d271668 Clean up user-edit.php, add password strength meter to Add User and E…
azaozz authored
354 <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
355 </td>
56673e4 Styling update for user edit form. Props mt. fixes #6140
ryan authored
356 </tr>
53eef6d Allowing more hooks into authentication - Hat tip: http://dev.webadmi…
matt authored
357 <?php endif; ?>
399da81 user edit form validation fixes
ryan authored
358 </table>
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
359
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
360 <?php
7b55c46 Move add/remove super admin out of bulk edit and into user-edit.php. …
nacin authored
361 if ( IS_PROFILE_PAGE )
362 do_action( 'show_user_profile', $profileuser );
363 else
364 do_action( 'edit_user_profile', $profileuser );
ece19d2 Merge user-edit.php and profile.php. Props nbachiyski. fixes #5736
ryan authored
365 ?>
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
366
aa1e377 Filter fields through kses upon display. Introduce sanitize_user_obje…
ryan authored
367 <?php if ( count($profileuser->caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?>
7a1db03 Reduce dependency on inline style. Props mdawaffe. fixes #6228
ryan authored
368 <br class="clear" />
577f12b Update deprecated attributes. Props hansengel. fixes #6037
ryan authored
369 <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
9f534eb Remove trailing spaces and convert spaces to tabs. Props Nazgul. fix…
ryan authored
370 <tr>
36617f1 Remove colons from field names. Props thee17. fixes #7158
ryan authored
371 <th scope="row"><?php _e('Additional Capabilities') ?></th>
9f534eb Remove trailing spaces and convert spaces to tabs. Props Nazgul. fix…
ryan authored
372 <td><?php
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
373 $output = '';
aa1e377 Filter fields through kses upon display. Introduce sanitize_user_obje…
ryan authored
374 foreach ( $profileuser->caps as $cap => $value ) {
375 if ( !$wp_roles->is_role($cap) ) {
376 if ( $output != '' )
377 $output .= ', ';
5ba66d6 User create/update rework. Introduce wp_insert_user(), wp_create_use…
ryan authored
378 $output .= $value ? $cap : "Denied: {$cap}";
379 }
380 }
381 echo $output;
382 ?></td>
9f534eb Remove trailing spaces and convert spaces to tabs. Props Nazgul. fix…
ryan authored
383 </tr>
384 </table>
aa1e377 Filter fields through kses upon display. Introduce sanitize_user_obje…
ryan authored
385 <?php } ?>
399da81 user edit form validation fixes
ryan authored
386
799baf1 Use submit_button() in more places. See #15064
scribu authored
387 <input type="hidden" name="action" value="update" />
388 <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
389
390 <?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
391
48ac42c Added ability to edit other users.
saxmatt authored
392 </form>
393 </div>
394 <?php
395 break;
396 }
7658f08 Focus on the password field if the user has come from the default pas…
nbachiyski authored
397 ?>
398 <script type="text/javascript" charset="utf-8">
399 if (window.location.hash == '#password') {
400 document.getElementById('pass1').focus();
401 }
402 </script>
403 <?php
21e3f0f Network Admin, first pass. see #14435
ryan authored
404 include( ABSPATH . 'wp-admin/admin-footer.php');
5123086 Change login noun to Username. http://mosquito.wordpress.org/view.ph…
ryan authored
405 ?>
Something went wrong with that request. Please try again.