Ticket #25726: 25726.2.diff
File 25726.2.diff, 9.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/user-edit.php
74 74 <?php 75 75 } 76 76 77 // Only allow super admins on multisite to edit every user. 78 if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) ) 77 /** 78 * Filter whether to allow administrators on Multisite to edit every user. 79 * 80 * Enabling the user editing form via this filter also hinges on the user holding 81 * the 'manage_network_users' cap, and the logged-in user not matching the user 82 * profile open for editing. 83 * 84 * The filter was introduced to replace the EDIT_ANY_USER constant. 85 * 86 * @since 3.0.0 87 * 88 * @param bool $allow Whether to allow editing of any user. Default true. 89 */ 90 if ( is_multisite() 91 && ! current_user_can( 'manage_network_users' ) 92 && $user_id != $current_user->ID 93 && ! apply_filters( 'enable_edit_any_user_configuration', true ) 94 ) { 79 95 wp_die( __( 'You do not have permission to edit this user.' ) ); 96 } 80 97 81 98 // Execute confirmed email change. See send_confirmation_on_profile_email(). 82 99 if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { … … 106 123 if ( !current_user_can('edit_user', $user_id) ) 107 124 wp_die(__('You do not have permission to edit this user.')); 108 125 109 if ( IS_PROFILE_PAGE ) 110 do_action('personal_options_update', $user_id); 111 else 112 do_action('edit_user_profile_update', $user_id); 126 if ( IS_PROFILE_PAGE ) { 127 /** 128 * Fires before the page loads on the 'Your Profile' editing screen. 129 * 130 * The action only fires if the current user is editing their own profile. 131 * 132 * @since 2.5.0 133 * 134 * @param int $user_id The user ID. 135 */ 136 do_action( 'personal_options_update', $user_id ); 137 } else { 138 /** 139 * Fires before the page loads on the 'Edit User' screen. 140 * 141 * @since 2.7.0 142 * 143 * @param int $user_id The user ID. 144 */ 145 do_action( 'edit_user_profile_update', $user_id ); 146 } 113 147 114 148 if ( !is_multisite() ) { 115 149 $errors = edit_user($user_id); … … 188 222 <?php } 189 223 } ?> 190 224 </h2> 191 192 <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'); ?>> 225 <?php 226 /** 227 * Fires inside the your-profile form tag on the user editing screen. 228 * 229 * @since 3.0.0 230 */ 231 ?> 232 <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' ); ?>> 193 233 <?php wp_nonce_field('update-user_' . $user_id) ?> 194 234 <?php if ( $wp_http_referer ) : ?> 195 235 <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" /> … … 211 251 <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?> 212 252 <tr> 213 253 <th scope="row"><?php _e('Admin Color Scheme')?></th> 214 <td><?php do_action( 'admin_color_scheme_picker' ); ?></td> 254 <?php 255 /** 256 * Fires in the 'Admin Color Scheme' section of the user editing screen. 257 * 258 * The section is only enabled if a callback is hooked to the action, 259 * and if there is more than one defined color scheme for the admin. 260 * 261 * @since 3.0.0 262 */ 263 ?> 264 <td><?php 6( 'admin_color_scheme_picker' ); ?></td> 215 265 </tr> 216 266 <?php 217 267 endif; // $_wp_admin_css_colors … … 230 280 </fieldset> 231 281 </td> 232 282 </tr> 233 <?php do_action('personal_options', $profileuser); ?> 283 <?php 284 /** 285 * Fires at the end of the 'Personal Options' settings table on the user editing screen. 286 * 287 * @since 2.7.0 288 * 289 * @param WP_User $profileuser The current WP_User object. 290 */ 291 do_action( 'personal_options', $profileuser ); 292 ?> 234 293 </table> 235 294 <?php 236 if ( IS_PROFILE_PAGE ) 237 do_action('profile_personal_options', $profileuser); 295 if ( IS_PROFILE_PAGE ) { 296 /** 297 * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen. 298 * 299 * The action only fires if the current user is editing their own profile. 300 * 301 * @since 2.0.0 302 * 303 * @param WP_User $profileuser The current WP_User object. 304 */ 305 do_action( 'profile_personal_options', $profileuser ); 306 } 238 307 ?> 239 308 240 309 <h3><?php _e('Name') ?></h3> … … 353 422 foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) { 354 423 ?> 355 424 <tr> 356 <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th> 425 <?php 426 /** 427 * Filter a user contactmethod label. 428 * 429 * The dynamic portion of the filter hook, $name, refers to 430 * each of the keys in the contactmethods array. 431 * 432 * @since 2.9.0 433 * 434 * @param string $desc The translatable label for the contactmethod. 435 */ 436 ?> 437 <th><label for="<?php echo $name; ?>"><?php echo apply_filters( "user_{$name}_label", $desc ); ?></label></th> 357 438 <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td> 358 439 </tr> 359 440 <?php … … 371 452 </tr> 372 453 373 454 <?php 374 $show_password_fields = apply_filters('show_password_fields', true, $profileuser); 455 /** This filter is documented in wp-admin/user-new.php */ 456 $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ); 375 457 if ( $show_password_fields ) : 376 458 ?> 377 459 <tr id="password"> … … 396 478 </table> 397 479 398 480 <?php 399 if ( IS_PROFILE_PAGE ) 481 if ( IS_PROFILE_PAGE ) { 482 /** 483 * Fires after the 'About the User' settings table on the 'Your Profile' editing screen. 484 * 485 * The action only fires if the current user is editing their own profile. 486 * 487 * @since 2.0.0 488 * 489 * @param WP_User $profileuser The current WP_User object. 490 */ 400 491 do_action( 'show_user_profile', $profileuser ); 401 else 492 } else { 493 /** 494 * Fires after the 'About the User' settings table on the 'Edit User' screen. 495 * 496 * @since 2.0.0 497 * 498 * @param WP_User $profileuser The current WP_User object. 499 */ 402 500 do_action( 'edit_user_profile', $profileuser ); 501 } 403 502 ?> 404 503 405 <?php if ( count( $profileuser->caps ) > count( $profileuser->roles ) && apply_filters( 'additional_capabilities_display', true, $profileuser ) ) : ?> 504 <?php 505 /** 506 * Filter whether to display additional capabilities for the user. 507 * 508 * The 'Additional Capabilities' section will only be enabled if 509 * the number of the user's capabilities exceeds their number of 510 * of roles. 511 * 512 * @param bool $enable Whether to display the capabilities. 513 * @param WP_User $profileuser The current WP_User object. 514 */ 515 if ( count( $profileuser->caps ) > count( $profileuser->roles ) 516 && apply_filters( 'additional_capabilities_display', true, $profileuser ) 517 ) : ?> 406 518 <h3><?php _e( 'Additional Capabilities' ); ?></h3> 407 519 <table class="form-table"> 408 520 <tr> -
src/wp-admin/user-new.php
117 117 $add_user_errors = $user_details[ 'errors' ]; 118 118 } else { 119 119 /** 120 * Filter the user_login, a kathe username, before it is added to the site.120 * Filter the user_login, also known as the username, before it is added to the site. 121 121 * 122 122 * @since 3.0.0 123 123 * 124 * @param string $ _REQUEST['user_login']The sanitized username.124 * @param string $user_login The sanitized username. 125 125 */ 126 126 $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); 127 127 if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { … … 189 189 wp_enqueue_script('user-profile'); 190 190 191 191 /** 192 * Allows you to enable user auto-complete for non-super admins in multisite.192 * Filter whether to enable user auto-complete for non-super admins in Multisite. 193 193 * 194 194 * @since 3.4.0 195 195 * 196 * @param bool True or false, based on if youenable auto-complete for non-super admins. Default is false.196 * @param bool $enable Whether to enable auto-complete for non-super admins. Default is false. 197 197 */ 198 198 if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) 199 199 && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) … … 320 320 * 321 321 * @since 3.7.0 322 322 * 323 * @param string A contextual string specifying which type of new user form the hook follows.323 * @param string $type A contextual string specifying which type of new user form the hook follows. 324 324 */ 325 325 do_action( 'user_new_form', 'add-existing-user' ); 326 326 ?> … … 334 334 echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>'; 335 335 ?> 336 336 <p><?php _e('Create a brand new user and add them to this site.'); ?></p> 337 <?php 338 /** This action is documented in wp-admin/user-new.php */ 339 ?> 337 <?php /** This action is documented in wp-admin/user-new.php */ ?> 340 338 <form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action('user_new_form_tag');?>> 341 339 <input name="action" type="hidden" value="createuser" /> 342 340 <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?> … … 382 380 * 383 381 * @since 1.5.1 384 382 * 385 * @param bool True or false, based on if you wantto show the password fields. Default is true.383 * @param bool $show Whether to show the password fields. Default is true. 386 384 */ 387 385 if ( apply_filters( 'show_password_fields', true ) ) : ?> 388 386 <tr class="form-field form-required"> -
src/wp-includes/user.php
1564 1564 * @since 2.9.0 1565 1565 * 1566 1566 * @param array $methods Array of contact methods and their labels. 1567 * @param WP_User $user Optional.WP_User object.1567 * @param WP_User $user WP_User object. 1568 1568 */ 1569 1569 return apply_filters( 'user_contactmethods', $methods, $user ); 1570 1570 }