Changeset 13941 for trunk/wp-admin/user-edit.php
- Timestamp:
- 04/02/2010 06:46:07 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/user-edit.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/user-edit.php
r13820 r13941 10 10 require_once('admin.php'); 11 11 12 if ( !defined('IS_PROFILE_PAGE') ) 13 define('IS_PROFILE_PAGE', false); 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.') ); 14 25 15 26 wp_enqueue_script('user-profile'); … … 23 34 $parent_file = 'users.php'; 24 35 25 wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));26 27 36 $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer)); 28 29 $user_id = (int) $user_id;30 31 if ( !$user_id ) {32 if ( IS_PROFILE_PAGE ) {33 $current_user = wp_get_current_user();34 $user_id = $current_user->ID;35 } else {36 wp_die(__('Invalid user ID.'));37 }38 } elseif ( !get_userdata($user_id) ) {39 wp_die( __('Invalid user ID.') );40 }41 37 42 38 $all_post_caps = array('posts', 'pages'); … … 124 120 $errors = edit_user($user_id); 125 121 if ( $delete_role ) // stops users being added to current blog when they are edited 126 update_user_meta( $user_id, $blog_prefix . 'capabilities' , '' ); 122 delete_user_meta( $user_id, $blog_prefix . 'capabilities' ); 123 124 if ( is_multisite() && is_super_admin() && !IS_PROFILE_PAGE ) 125 empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id ); 127 126 } 128 127 … … 143 142 ?> 144 143 144 <?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) ) { ?> 145 <div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div> 146 <?php } ?> 145 147 <?php if ( isset($_GET['updated']) ) : ?> 146 148 <div id="message" class="updated"> … … 166 168 <h2><?php echo esc_html( $title ); ?></h2> 167 169 168 <form id="your-profile" action="<?php if ( IS_PROFILE_PAGE ) { echo admin_url('profile.php'); } else { echo admin_url('user-edit.php'); }?>" method="post">170 <form id="your-profile" action="<?php echo esc_url( admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"> 169 171 <?php wp_nonce_field('update-user_' . $user_id) ?> 170 172 <?php if ( $wp_http_referer ) : ?> … … 233 235 echo '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>'; 234 236 ?> 235 </select></td></tr> 237 </select> 238 <?php if ( is_multisite() && is_super_admin() ) { ?> 239 <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> 240 <?php } ?> 241 </td></tr> 236 242 <?php endif; //!IS_PROFILE_PAGE ?> 237 243 … … 332 338 333 339 <?php 334 if ( IS_PROFILE_PAGE ) { 335 do_action('show_user_profile', $profileuser); 336 } else { 337 do_action('edit_user_profile', $profileuser); 338 } 340 if ( IS_PROFILE_PAGE ) 341 do_action( 'show_user_profile', $profileuser ); 342 else 343 do_action( 'edit_user_profile', $profileuser ); 339 344 ?> 340 345
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)