WordPress.org

Make WordPress Core

Ticket #11271: 11271.diff

File 11271.diff, 4.7 KB (added by westi, 8 years ago)

Change the user editor to use it's own global variable with a more unique name

  • wp-admin/includes/template.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    19131913                if ($current_user->ID == $user_object->ID) {
    19141914                        $edit_link = 'profile.php';
    19151915                } else {
    1916                         $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
     1916                        $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_to_edit=$user_object->ID" ) );
    19171917                }
    19181918                $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
    19191919
  • wp-admin/user-edit.php

     
    2222        $submenu_file = 'profile.php';
    2323$parent_file = 'users.php';
    2424
    25 wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
     25wp_reset_vars(array('action', 'redirect', 'profile', 'user_to_edit', 'wp_http_referer'));
    2626
    2727$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
    2828
    29 $user_id = (int) $user_id;
     29$user_to_edit = (int) $user_to_edit;
    3030
    31 if ( !$user_id ) {
     31if ( !$user_to_edit ) {
    3232        if ( IS_PROFILE_PAGE ) {
    3333                $current_user = wp_get_current_user();
    34                 $user_id = $current_user->ID;
     34                $user_to_edit = $current_user->ID;
    3535        } else {
    3636                wp_die(__('Invalid user ID.'));
    3737        }
    38 } elseif ( !get_userdata($user_id) ) {
     38} elseif ( !get_userdata($user_to_edit) ) {
    3939        wp_die( __('Invalid user ID.') );
    4040}
    4141
     
    7171
    7272case 'update':
    7373
    74 check_admin_referer('update-user_' . $user_id);
     74check_admin_referer('update-user_' . $user_to_edit);
    7575
    76 if ( !current_user_can('edit_user', $user_id) )
     76if ( !current_user_can('edit_user', $user_to_edit) )
    7777        wp_die(__('You do not have permission to edit this user.'));
    7878
    7979if ( IS_PROFILE_PAGE )
    80         do_action('personal_options_update', $user_id);
     80        do_action('personal_options_update', $user_to_edit);
    8181else
    82         do_action('edit_user_profile_update', $user_id);
     82        do_action('edit_user_profile_update', $user_to_edit);
    8383
    84 $errors = edit_user($user_id);
     84$errors = edit_user($user_to_edit);
    8585
    8686if ( !is_wp_error( $errors ) ) {
    87         $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
     87        $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_to_edit=$user_to_edit&"). "updated=true";
    8888        $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
    8989        wp_redirect($redirect);
    9090        exit;
    9191}
    9292
    9393default:
    94 $profileuser = get_user_to_edit($user_id);
     94$profileuser = get_user_to_edit($user_to_edit);
    9595
    96 if ( !current_user_can('edit_user', $user_id) )
     96if ( !current_user_can('edit_user', $user_to_edit) )
    9797        wp_die(__('You do not have permission to edit this user.'));
    9898
    9999include ('admin-header.php');
     
    123123<h2><?php echo esc_html( $title ); ?></h2>
    124124
    125125<form id="your-profile" action="<?php if ( IS_PROFILE_PAGE ) { echo admin_url('profile.php'); } else { echo admin_url('user-edit.php'); } ?>" method="post">
    126 <?php wp_nonce_field('update-user_' . $user_id) ?>
     126<?php wp_nonce_field('update-user_' . $user_to_edit) ?>
    127127<?php if ( $wp_http_referer ) : ?>
    128128        <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
    129129<?php endif; ?>
    130130<p>
    131131<input type="hidden" name="from" value="profile" />
    132 <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
     132<input type="hidden" name="checkuser_id" value="<?php echo $user_to_edit ?>" />
    133133</p>
    134134
    135135<h3><?php _e('Personal Options'); ?></h3>
     
    146146<th scope="row"><?php _e('Admin Color Scheme')?></th>
    147147<td><fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
    148148<?php
    149 $current_color = get_user_option('admin_color', $user_id);
     149$current_color = get_user_option('admin_color', $user_to_edit);
    150150if ( empty($current_color) )
    151151        $current_color = 'fresh';
    152152foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
     
    333333
    334334<p class="submit">
    335335        <input type="hidden" name="action" value="update" />
    336         <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
     336        <input type="hidden" name="user_to_edit" id="user_to_edit" value="<?php echo esc_attr($user_to_edit); ?>" />
    337337        <input type="submit" class="button-primary" value="<?php IS_PROFILE_PAGE ? esc_attr_e('Update Profile') : esc_attr_e('Update User') ?>" name="submit" />
    338338</p>
    339339</form>