| 1 | Index: user-edit.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- user-edit.php (Revision 13628) |
|---|
| 4 | +++ user-edit.php (Arbeitskopie) |
|---|
| 5 | @@ -175,30 +175,29 @@ |
|---|
| 6 | <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" /> |
|---|
| 7 | </p> |
|---|
| 8 | |
|---|
| 9 | -<h3><?php _e('Personal Options'); ?></h3> |
|---|
| 10 | +<?php |
|---|
| 11 | |
|---|
| 12 | +$user_personal_options = _wp_get_user_personal_options($user_can_edit); |
|---|
| 13 | + |
|---|
| 14 | +if (!empty($user_personal_options)) { ?> |
|---|
| 15 | + |
|---|
| 16 | +<div id="profile-personal-options"> |
|---|
| 17 | + |
|---|
| 18 | +<h3 id="profile-personal-options-title"><?php _e('Personal Options'); ?></h3> |
|---|
| 19 | + |
|---|
| 20 | <table class="form-table"> |
|---|
| 21 | -<?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?> |
|---|
| 22 | - <tr> |
|---|
| 23 | - <th scope="row"><?php _e('Visual Editor')?></th> |
|---|
| 24 | - <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> |
|---|
| 25 | - </tr> |
|---|
| 26 | -<?php endif; ?> |
|---|
| 27 | -<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?> |
|---|
| 28 | -<tr> |
|---|
| 29 | -<th scope="row"><?php _e('Admin Color Scheme')?></th> |
|---|
| 30 | -<td><?php do_action( 'admin_color_scheme_picker' ); ?></td> |
|---|
| 31 | + |
|---|
| 32 | +<?php |
|---|
| 33 | + foreach ($user_personal_options as $code) { |
|---|
| 34 | +?> |
|---|
| 35 | +<tr id="profile-personal-options-<?php echo $code['name']; ?>"> |
|---|
| 36 | + <th<?php echo $code['scope']; ?>><label for="<?php echo $code['name']; ?>"><?php echo apply_filters('user_'.$code['name'].'_label', $code['desc']); ?></label></th> |
|---|
| 37 | + <td><?php if ($code['code']=='admin_color_scheme_picker') do_action( 'admin_color_scheme_picker' ); else echo $code['code']; ?></td> |
|---|
| 38 | </tr> |
|---|
| 39 | <?php |
|---|
| 40 | -endif; // $_wp_admin_css_colors |
|---|
| 41 | -if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?> |
|---|
| 42 | -<tr> |
|---|
| 43 | -<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th> |
|---|
| 44 | -<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> |
|---|
| 45 | -</tr> |
|---|
| 46 | -<?php |
|---|
| 47 | -endif; |
|---|
| 48 | -do_action('personal_options', $profileuser); |
|---|
| 49 | + } |
|---|
| 50 | + |
|---|
| 51 | + do_action('personal_options', $profileuser); |
|---|
| 52 | ?> |
|---|
| 53 | </table> |
|---|
| 54 | <?php |
|---|
| 55 | @@ -206,51 +205,40 @@ |
|---|
| 56 | do_action('profile_personal_options', $profileuser); |
|---|
| 57 | ?> |
|---|
| 58 | |
|---|
| 59 | -<h3><?php _e('Name') ?></h3> |
|---|
| 60 | +</div> |
|---|
| 61 | |
|---|
| 62 | -<table class="form-table"> |
|---|
| 63 | - <tr> |
|---|
| 64 | - <th><label for="user_login"><?php _e('Username'); ?></label></th> |
|---|
| 65 | - <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('Your username cannot be changed.'); ?></span></td> |
|---|
| 66 | - </tr> |
|---|
| 67 | - |
|---|
| 68 | -<?php if ( !IS_PROFILE_PAGE ): ?> |
|---|
| 69 | -<tr><th><label for="role"><?php _e('Role:') ?></label></th> |
|---|
| 70 | -<td><select name="role" id="role"> |
|---|
| 71 | <?php |
|---|
| 72 | -// Get the highest/primary role for this user |
|---|
| 73 | -// TODO: create a function that does this: wp_get_user_role() |
|---|
| 74 | -$user_roles = $profileuser->roles; |
|---|
| 75 | -$user_role = array_shift($user_roles); |
|---|
| 76 | +} |
|---|
| 77 | |
|---|
| 78 | -// print the full list of roles with the primary one selected. |
|---|
| 79 | -wp_dropdown_roles($user_role); |
|---|
| 80 | +// For backwards compatibility |
|---|
| 81 | +function user_label_add_required($desc){ |
|---|
| 82 | + return $desc.' <span class="description">'. __('(required)').'</span>'; |
|---|
| 83 | +} |
|---|
| 84 | +add_filter('user_user_email_label','user_label_add_required'); |
|---|
| 85 | +add_filter('user_nickname_label','user_label_add_required'); |
|---|
| 86 | |
|---|
| 87 | -// print the 'no role' option. Make it selected if the user has no role yet. |
|---|
| 88 | -if ( $user_role ) |
|---|
| 89 | - echo '<option value="">' . __('— No role for this blog —') . '</option>'; |
|---|
| 90 | -else |
|---|
| 91 | - echo '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>'; |
|---|
| 92 | -?> |
|---|
| 93 | -</select></td></tr> |
|---|
| 94 | -<?php endif; //!IS_PROFILE_PAGE ?> |
|---|
| 95 | +$user_namefields = _wp_get_user_namefields(); |
|---|
| 96 | |
|---|
| 97 | -<tr> |
|---|
| 98 | - <th><label for="first_name"><?php _e('First Name') ?></label></th> |
|---|
| 99 | - <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td> |
|---|
| 100 | -</tr> |
|---|
| 101 | +if (!empty($user_namefields)) { ?> |
|---|
| 102 | |
|---|
| 103 | -<tr> |
|---|
| 104 | - <th><label for="last_name"><?php _e('Last Name') ?></label></th> |
|---|
| 105 | - <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td> |
|---|
| 106 | -</tr> |
|---|
| 107 | +<div id="profile-name"> |
|---|
| 108 | |
|---|
| 109 | -<tr> |
|---|
| 110 | - <th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
|---|
| 111 | - <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td> |
|---|
| 112 | +<h3 id="profile-name-title"><?php _e('Name') ?></h3> |
|---|
| 113 | + |
|---|
| 114 | +<table class="form-table" > |
|---|
| 115 | + |
|---|
| 116 | +<?php |
|---|
| 117 | + foreach ($user_namefields as $name => $desc) { |
|---|
| 118 | +?> |
|---|
| 119 | +<tr id="profile-name-<?php echo $name; ?>"> |
|---|
| 120 | + <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th> |
|---|
| 121 | + <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td> |
|---|
| 122 | </tr> |
|---|
| 123 | +<?php |
|---|
| 124 | + } |
|---|
| 125 | +?> |
|---|
| 126 | |
|---|
| 127 | -<tr> |
|---|
| 128 | +<tr id="profile-name-display-name"> |
|---|
| 129 | <th><label for="display_name"><?php _e('Display name publicly as') ?></label></th> |
|---|
| 130 | <td> |
|---|
| 131 | <select name="display_name" id="display_name"> |
|---|
| 132 | @@ -279,25 +267,50 @@ |
|---|
| 133 | </select> |
|---|
| 134 | </td> |
|---|
| 135 | </tr> |
|---|
| 136 | + |
|---|
| 137 | +<?php if ( !IS_PROFILE_PAGE ): ?> |
|---|
| 138 | +<tr id="profile-name-role"><th><label for="role"><?php _e('Role:') ?></label></th> |
|---|
| 139 | +<td><select name="role" id="role"> |
|---|
| 140 | +<?php |
|---|
| 141 | +// Get the highest/primary role for this user |
|---|
| 142 | +// TODO: create a function that does this: wp_get_user_role() |
|---|
| 143 | +$user_roles = $profileuser->roles; |
|---|
| 144 | +$user_role = array_shift($user_roles); |
|---|
| 145 | + |
|---|
| 146 | +// print the full list of roles with the primary one selected. |
|---|
| 147 | +wp_dropdown_roles($user_role); |
|---|
| 148 | + |
|---|
| 149 | +// print the 'no role' option. Make it selected if the user has no role yet. |
|---|
| 150 | +if ( $user_role ) |
|---|
| 151 | + echo '<option value="">' . __('— No role for this blog —') . '</option>'; |
|---|
| 152 | +else |
|---|
| 153 | + echo '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>'; |
|---|
| 154 | +?> |
|---|
| 155 | +</select></td></tr> |
|---|
| 156 | +<?php endif; //!IS_PROFILE_PAGE ?> |
|---|
| 157 | + |
|---|
| 158 | </table> |
|---|
| 159 | |
|---|
| 160 | -<h3><?php _e('Contact Info') ?></h3> |
|---|
| 161 | +</div> |
|---|
| 162 | |
|---|
| 163 | -<table class="form-table"> |
|---|
| 164 | -<tr> |
|---|
| 165 | - <th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
|---|
| 166 | - <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" /></td> |
|---|
| 167 | -</tr> |
|---|
| 168 | +<?php |
|---|
| 169 | +} |
|---|
| 170 | |
|---|
| 171 | -<tr> |
|---|
| 172 | - <th><label for="url"><?php _e('Website') ?></label></th> |
|---|
| 173 | - <td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td> |
|---|
| 174 | -</tr> |
|---|
| 175 | +$user_contactmethods = _wp_get_user_contactmethods(); |
|---|
| 176 | |
|---|
| 177 | -<?php |
|---|
| 178 | - foreach (_wp_get_user_contactmethods() as $name => $desc) { |
|---|
| 179 | +if (!empty($user_contactmethods)) { |
|---|
| 180 | ?> |
|---|
| 181 | -<tr> |
|---|
| 182 | + |
|---|
| 183 | +<div id="profile-contact-info"> |
|---|
| 184 | + |
|---|
| 185 | +<h3 id="profile-contact-info-title"><?php _e('Contact Info') ?></h3> |
|---|
| 186 | + |
|---|
| 187 | +<table class="form-table"> |
|---|
| 188 | + |
|---|
| 189 | +<?php |
|---|
| 190 | + foreach ($user_contactmethods as $name => $desc) { |
|---|
| 191 | +?> |
|---|
| 192 | +<tr id="profile-contact-info-<?php echo $name; ?>"> |
|---|
| 193 | <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th> |
|---|
| 194 | <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td> |
|---|
| 195 | </tr> |
|---|
| 196 | @@ -306,10 +319,17 @@ |
|---|
| 197 | ?> |
|---|
| 198 | </table> |
|---|
| 199 | |
|---|
| 200 | -<h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3> |
|---|
| 201 | +</div> |
|---|
| 202 | +<?php |
|---|
| 203 | +} |
|---|
| 204 | +?> |
|---|
| 205 | |
|---|
| 206 | +<div id="profile-about-yourself"> |
|---|
| 207 | + |
|---|
| 208 | +<h3 id="profile-about-yourself-title"><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3> |
|---|
| 209 | + |
|---|
| 210 | <table class="form-table"> |
|---|
| 211 | -<tr> |
|---|
| 212 | +<tr id="profile-about-yourself-description"> |
|---|
| 213 | <th><label for="description"><?php _e('Biographical Info'); ?></label></th> |
|---|
| 214 | <td><textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html($profileuser->description); ?></textarea><br /> |
|---|
| 215 | <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td> |
|---|
| 216 | @@ -330,6 +350,8 @@ |
|---|
| 217 | <?php endif; ?> |
|---|
| 218 | </table> |
|---|
| 219 | |
|---|
| 220 | +</div> |
|---|
| 221 | + |
|---|
| 222 | <?php |
|---|
| 223 | if ( IS_PROFILE_PAGE ) { |
|---|
| 224 | do_action('show_user_profile', $profileuser); |
|---|
| 225 | @@ -339,6 +361,8 @@ |
|---|
| 226 | ?> |
|---|
| 227 | |
|---|
| 228 | <?php if ( count($profileuser->caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?> |
|---|
| 229 | +<div id="profile-caps"> |
|---|
| 230 | + |
|---|
| 231 | <br class="clear" /> |
|---|
| 232 | <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform"> |
|---|
| 233 | <tr> |
|---|
| 234 | @@ -356,6 +380,7 @@ |
|---|
| 235 | ?></td> |
|---|
| 236 | </tr> |
|---|
| 237 | </table> |
|---|
| 238 | +</div> |
|---|
| 239 | <?php } ?> |
|---|
| 240 | |
|---|
| 241 | <p class="submit"> |
|---|
| 242 | Index: registration.php |
|---|
| 243 | =================================================================== |
|---|
| 244 | --- registration.php (Revision 13628) |
|---|
| 245 | +++ registration.php (Arbeitskopie) |
|---|
| 246 | @@ -323,6 +323,8 @@ |
|---|
| 247 | */ |
|---|
| 248 | function _wp_get_user_contactmethods() { |
|---|
| 249 | $user_contactmethods = array( |
|---|
| 250 | + 'user_email' => __('E-Mail'), |
|---|
| 251 | + 'user_url' => __('Website'), |
|---|
| 252 | 'aim' => __('AIM'), |
|---|
| 253 | 'yim' => __('Yahoo IM'), |
|---|
| 254 | 'jabber' => __('Jabber / Google Talk') |
|---|
| 255 | @@ -330,4 +332,60 @@ |
|---|
| 256 | return apply_filters('user_contactmethods',$user_contactmethods); |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | +/** |
|---|
| 260 | + * Setup the default name fields |
|---|
| 261 | + * |
|---|
| 262 | + * @access private |
|---|
| 263 | + * @since |
|---|
| 264 | + * |
|---|
| 265 | + * @return array $user_namefields Array of contact methods and their labels. |
|---|
| 266 | + */ |
|---|
| 267 | +function _wp_get_user_namefields() { |
|---|
| 268 | + $user_namefields = array( |
|---|
| 269 | + 'user_login' => __('Username'), |
|---|
| 270 | + 'first_name' => __('First Name'), |
|---|
| 271 | + 'last_name' => __('Last Name'), |
|---|
| 272 | + 'nickname' => __('Nickname'), |
|---|
| 273 | + ); |
|---|
| 274 | + return apply_filters('user_namefields',$user_namefields); |
|---|
| 275 | +} |
|---|
| 276 | + |
|---|
| 277 | +/** |
|---|
| 278 | + * Setup the default personal options |
|---|
| 279 | + * |
|---|
| 280 | + * @access private |
|---|
| 281 | + * @since |
|---|
| 282 | + * |
|---|
| 283 | + * @return array $user_personal_options Array of personal options and their input code |
|---|
| 284 | + */ |
|---|
| 285 | +function _wp_get_user_personal_options($user_can_edit) { |
|---|
| 286 | + global $user_id; |
|---|
| 287 | + $profileuser = get_user_to_edit($user_id); |
|---|
| 288 | + if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) { // don't bother showing the option if the editor has been removed |
|---|
| 289 | + $user_personal_options['rich_editing'] = array( |
|---|
| 290 | + 'name' => 'rich_editing', |
|---|
| 291 | + 'desc' => __('Visual Editor'), |
|---|
| 292 | + 'code' => '<label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" '.checked('false', $profileuser->rich_editing, false).' /> '. __('Disable the visual editor when writing').'</label>' |
|---|
| 293 | + ); |
|---|
| 294 | + }; |
|---|
| 295 | + global $_wp_admin_css_colors; |
|---|
| 296 | + if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) { |
|---|
| 297 | + $user_personal_options['admin_color_scheme_picker'] = array( |
|---|
| 298 | + 'name' => 'admin_color_scheme_picker', |
|---|
| 299 | + 'desc' => __('Admin Color Scheme'), |
|---|
| 300 | + 'code' => 'admin_color_scheme_picker', |
|---|
| 301 | + 'scope' => ' scope="row"' |
|---|
| 302 | + ); |
|---|
| 303 | + }; |
|---|
| 304 | + if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) { |
|---|
| 305 | + if ( !empty($profileuser->comment_shortcuts) ) $checked = checked('true', $profileuser->comment_shortcuts, false); |
|---|
| 306 | + $user_personal_options['comment_shortcuts'] = array( |
|---|
| 307 | + 'name' => 'rich_editing', |
|---|
| 308 | + 'desc' => __('Keyboard Shortcuts'), |
|---|
| 309 | + 'code' => '<label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" '.$checked.' /> '. __('Enable keyboard shortcuts for comment moderation.').'</label> '. __('<a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>') |
|---|
| 310 | + ); |
|---|
| 311 | + }; |
|---|
| 312 | + return apply_filters('user_personal_options', $user_personal_options); |
|---|
| 313 | +} |
|---|
| 314 | + |
|---|
| 315 | ?> |
|---|