Ticket #12295: 12295.005.diff
File 12295.005.diff, 13.4 KB (added by , 13 years ago) |
---|
-
wp-includes/registration.php
323 323 */ 324 324 function _wp_get_user_contactmethods() { 325 325 $user_contactmethods = array( 326 'user_email' => __('E-Mail'), 327 'user_url' => __('Website'), 326 328 'aim' => __('AIM'), 327 329 'yim' => __('Yahoo IM'), 328 330 'jabber' => __('Jabber / Google Talk') … … 330 332 return apply_filters('user_contactmethods',$user_contactmethods); 331 333 } 332 334 335 /** 336 * Setup the default name fields 337 * 338 * @access private 339 * @since 340 * 341 * @return array $user_namefields Array of contact methods and their labels. 342 */ 343 function _wp_get_user_namefields() { 344 $user_namefields = array( 345 'user_login' => __('Username'), 346 'first_name' => __('First Name'), 347 'last_name' => __('Last Name'), 348 'nickname' => __('Nickname'), 349 ); 350 return apply_filters('user_namefields',$user_namefields); 351 } 352 353 /** 354 * Setup the default personal options 355 * 356 * @access private 357 * @since 358 * 359 * @return array $user_personal_options Array of personal options and their input code 360 */ 361 function _wp_get_user_personal_options($user_can_edit) { 362 global $user_id; 363 $profileuser = get_user_to_edit($user_id); 364 if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) { // don't bother showing the option if the editor has been removed 365 $user_personal_options['rich_editing'] = array( 366 'name' => 'rich_editing', 367 'desc' => __('Visual Editor'), 368 '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>' 369 ); 370 }; 371 global $_wp_admin_css_colors; 372 if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) { 373 $user_personal_options['admin_color_scheme_picker'] = array( 374 'name' => 'admin_color_scheme_picker', 375 'desc' => __('Admin Color Scheme'), 376 'code' => 'admin_color_scheme_picker', 377 'scope' => ' scope="row"' 378 ); 379 }; 380 if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) { 381 if ( !empty($profileuser->comment_shortcuts) ) $checked = checked('true', $profileuser->comment_shortcuts, false); 382 $user_personal_options['comment_shortcuts'] = array( 383 'name' => 'rich_editing', 384 'desc' => __('Keyboard Shortcuts'), 385 '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>') 386 ); 387 }; 388 return apply_filters('user_personal_options', $user_personal_options); 389 } 390 333 391 ?> -
wp-admin/user-edit.php
187 187 <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" /> 188 188 </p> 189 189 190 <h3><?php _e('Personal Options'); ?></h3> 190 <?php 191 192 $user_personal_options = _wp_get_user_personal_options($user_can_edit); 193 194 if (!empty($user_personal_options)) { ?> 195 196 <div id="profile-personal-options"> 197 198 <h3 id="profile-personal-options-title"><?php _e('Personal Options'); ?></h3> 191 199 192 200 <table class="form-table"> 193 <?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?> 194 <tr> 195 <th scope="row"><?php _e('Visual Editor')?></th> 196 <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> 197 </tr> 198 <?php endif; ?> 199 <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?> 200 <tr> 201 <th scope="row"><?php _e('Admin Color Scheme')?></th> 202 <td><?php do_action( 'admin_color_scheme_picker' ); ?></td> 201 202 <?php 203 foreach ($user_personal_options as $code) { 204 ?> 205 <tr id="profile-personal-options-<?php echo $code['name']; ?>"> 206 <th<?php echo $code['scope']; ?>><label for="<?php echo $code['name']; ?>"><?php echo apply_filters('user_'.$code['name'].'_label', $code['desc']); ?></label></th> 207 <td><?php if ($code['code']=='admin_color_scheme_picker') do_action( 'admin_color_scheme_picker' ); else echo $code['code']; ?></td> 203 208 </tr> 204 209 <?php 205 endif; // $_wp_admin_css_colors 206 if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?> 207 <tr> 208 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th> 209 <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> 210 </tr> 211 <?php 212 endif; 213 do_action('personal_options', $profileuser); 210 } 211 212 do_action('personal_options', $profileuser); 214 213 ?> 215 214 </table> 216 215 <?php … … 218 217 do_action('profile_personal_options', $profileuser); 219 218 ?> 220 219 221 < h3><?php _e('Name') ?></h3>220 </div> 222 221 223 <table class="form-table">224 <tr>225 <th><label for="user_login"><?php _e('Username'); ?></label></th>226 <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>227 </tr>228 229 <?php if ( !IS_PROFILE_PAGE ): ?>230 <tr><th><label for="role"><?php _e('Role:') ?></label></th>231 <td><select name="role" id="role">232 222 <?php 233 // Get the highest/primary role for this user234 // TODO: create a function that does this: wp_get_user_role()235 $user_roles = $profileuser->roles;236 $user_role = array_shift($user_roles);237 223 238 // print the full list of roles with the primary one selected. 239 wp_dropdown_roles($user_role); 224 } 240 225 241 // print the 'no role' option. Make it selected if the user has no role yet. 242 if ( $user_role ) 243 echo '<option value="">' . __('— No role for this site —') . '</option>'; 244 else 245 echo '<option value="" selected="selected">' . __('— No role for this site —') . '</option>'; 246 ?> 247 </select> 248 <?php if ( is_multisite() && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?> 249 <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> 250 <?php } ?> 251 </td></tr> 252 <?php endif; //!IS_PROFILE_PAGE ?> 226 // For backwards compatibility 227 function user_label_add_required($desc){ 228 return $desc.' <span class="description">'. __('(required)').'</span>'; 229 } 230 add_filter('user_user_email_label','user_label_add_required'); 231 add_filter('user_nickname_label','user_label_add_required'); 232 $user_namefields = _wp_get_user_namefields(); 253 233 254 <tr> 255 <th><label for="first_name"><?php _e('First Name') ?></label></th> 256 <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td> 257 </tr> 234 if (!empty($user_namefields)) { ?> 258 235 259 <tr> 260 <th><label for="last_name"><?php _e('Last Name') ?></label></th> 261 <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td> 262 </tr> 236 <div id="profile-name"> 237 <h3 id="profile-name-title"><?php _e('Name') ?></h3> 238 239 <table class="form-table" > 240 241 <?php 242 foreach ($user_namefields as $name => $desc) { 243 ?> 244 <tr id="profile-name-<?php echo $name; ?>"> 245 <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th> 246 <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td> 247 </tr> 248 <?php 249 } 250 ?> 263 251 264 <tr> 265 <th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> 266 <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td> 267 </tr> 268 269 <tr> 252 <tr id="profile-name-display-name"> 270 253 <th><label for="display_name"><?php _e('Display name publicly as') ?></label></th> 271 254 <td> 272 255 <select name="display_name" id="display_name"> … … 295 278 </select> 296 279 </td> 297 280 </tr> 281 282 283 <?php if ( !IS_PROFILE_PAGE ): ?> 284 <tr id="profile-name-role"><th><label for="role"><?php _e('Role:') ?></label></th> 285 <td><select name="role" id="role"> 286 <?php 287 // Get the highest/primary role for this user 288 $user_roles = $profileuser->roles; 289 $user_role = array_shift($user_roles); 290 291 // print the full list of roles with the primary one selected. 292 wp_dropdown_roles($user_role); 293 294 // print the 'no role' option. Make it selected if the user has no role yet. 295 if ( $user_role ) 296 echo '<option value="">' . __('— No role for this blog —') . '</option>'; 297 else 298 echo '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>'; 299 ?> 300 </select><?php if ( is_multisite() && is_super_admin() ) { ?> 301 <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> 302 <?php } ?> 303 </td></tr> 304 <?php endif; //!IS_PROFILE_PAGE ?> 305 298 306 </table> 299 307 300 < h3><?php _e('Contact Info') ?></h3>308 </div> 301 309 302 <table class="form-table"> 303 <tr> 304 <th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> 305 <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" /> 310 <?php 311 } 312 313 $user_contactmethods = _wp_get_user_contactmethods(); 314 315 if (!empty($user_contactmethods)) { ?> 316 317 318 <div id="profile-contact-info"> 319 320 <h3 id="profile-contact-info-title"><?php _e('Contact Info') ?></h3> 321 322 <table class="form-table"> 323 324 <?php 325 foreach ($user_contactmethods as $name => $desc) { 326 ?> 327 <tr id="profile-contact-info-<?php echo $name; ?>"> 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" /> 306 330 <?php 307 $new_email = get_option( $current_user->ID . '_new_email' ); 308 if ( $new_email && $new_email != $current_user->user_email ) : ?> 309 <div class="updated inline"> 310 <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( admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p> 311 </div> 312 <?php endif; ?> 313 </td> 331 if ($name="user_email") { 332 $new_email = get_option( $current_user->ID . '_new_email' ); 333 if ( $new_email && $new_email != $current_user->user_email ) : ?> 334 <div class="updated inline"> 335 <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( admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p> 336 </div> 337 <?php endif; 338 }; 339 ?> 340 </td> 314 341 </tr> 315 342 316 <tr>317 <th><label for="url"><?php _e('Website') ?></label></th>318 <td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>319 </tr>320 321 343 <?php 322 foreach (_wp_get_user_contactmethods() as $name => $desc) {323 ?>324 <tr>325 <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>326 <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>327 </tr>328 <?php329 344 } 330 345 ?> 331 346 </table> 332 347 333 <h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3> 348 </div> 349 <?php 350 } 351 ?> 334 352 353 <div id="profile-about-yourself"> 354 355 <h3 id="profile-about-yourself-title"><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3> 356 335 357 <table class="form-table"> 336 <tr >358 <tr id="profile-about-yourself-description"> 337 359 <th><label for="description"><?php _e('Biographical Info'); ?></label></th> 338 360 <td><textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html($profileuser->description); ?></textarea><br /> 339 361 <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td> … … 354 376 <?php endif; ?> 355 377 </table> 356 378 379 </div> 380 357 381 <?php 358 382 if ( IS_PROFILE_PAGE ) 359 383 do_action( 'show_user_profile', $profileuser ); … … 362 386 ?> 363 387 364 388 <?php if ( count($profileuser->caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser) ) { ?> 389 <div id="profile-caps"> 390 365 391 <br class="clear" /> 366 392 <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform"> 367 393 <tr> … … 379 405 ?></td> 380 406 </tr> 381 407 </table> 408 </div> 382 409 <?php } ?> 383 410 384 411 <p class="submit">