Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#26607 closed defect (bug) (fixed)

Changing the admin color scheme for another user changes your own scheme

Reported by: tobiasbg's profile TobiasBg Owned by:
Milestone: 3.8.1 Priority: normal
Severity: normal Version: 3.8
Component: Administration Keywords: has-patch fixed-major
Focuses: Cc:

Description

  1. Login as an admin.
  2. Go to example.com/wp-admin/users.php
  3. Choose to edit a user other than yourself.
  4. The admin color scheme picker on /wp-admin/user-edit.php will change your admin color scheme, but not that of the edited user.

Reason: admin_color_scheme_picker() (in /wp-admin/includes/misc.php) always loads the current user's color scheme, and wp_ajax_save_user_color_scheme() in /wp-admin/includes/ajax-actions.php always sets it for the current user.

Attachments (4)

26607.patch (789 bytes) - added by rachelbaker 11 years ago.
Hides admin color picker from user profiles that are not the current user.
26607.2.patch (2.2 KB) - added by SergeyBiryukov 11 years ago.
26607.3.patch (688 bytes) - added by SergeyBiryukov 11 years ago.
26607.diff (1.2 KB) - added by nacin 11 years ago.

Download all attachments as: .zip

Change History (18)

#1 @SergeyBiryukov
11 years ago

I guess we should either hide the color scheme picker on other profiles, or allow to change it for other users.

#2 @rachelbaker
11 years ago

  • Cc rachel@… added

@rachelbaker
11 years ago

Hides admin color picker from user profiles that are not the current user.

#3 @miqrogroove
11 years ago

Hiding the color picker would be a regression for someone, somewhere. WP 3.7 and earlier always showed the Admin Color Scheme when editing other users. How about a proper fix instead?

#4 @SergeyBiryukov
11 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.8.1

Technically appears to be a regression. 26607.2.patch is an attempt at restoring the 3.7 behaviour.

#5 follow-up: @nacin
11 years ago

user-profile.js has a check if ( user_id === current_user_id ) {. I guess it is broken? It was designed to prevent previewing *and* saving when viewing something other than your profile.

#6 in reply to: ↑ 5 ; follow-up: @SergeyBiryukov
11 years ago

Replying to nacin:

user-profile.js has a check if ( user_id === current_user_id ) {. I guess it is broken?

Good point, I can't actually reproduce the 4th point of the ticket description.

There's still a change in the behaviour though. In 3.7, you could set a color scheme for a user. In 3.8, you can't. Is that an intended change?

A related issue: when I open another user for editing, the color picker displays my color scheme, not the user's. 26607.3.patch fixes just that.

#7 in reply to: ↑ 6 ; follow-up: @nacin
11 years ago

Replying to SergeyBiryukov:

There's still a change in the behaviour though. In 3.7, you could set a color scheme for a user. In 3.8, you can't. Is that an intended change?

I recall this as working for me. It doesn't do the XHR but "Save Changes" will let edit_user() do its thing.

#8 in reply to: ↑ 7 @SergeyBiryukov
11 years ago

Replying to nacin:

I recall this as working for me. It doesn't do the XHR but "Save Changes" will let edit_user() do its thing.

Confirmed. Looks like 26607.3.patch is the only thing needed here then.

#9 @TobiasBg
11 years ago

Yep, 26607.3.patch fixes the issue for me. And indeed, the 4th point in the ticket is not accurate. It should have been: "The color scheme picker will show your current color scheme instead of that of the edited user."

This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.


11 years ago

@nacin
11 years ago

#11 @helen
11 years ago

In 26924:

Pass the $user_id to the admin_color_scheme_picker hook for context. props nacin. see #26607 for trunk.

#12 @helen
11 years ago

  • Keywords fixed-major added

#13 @nacin
11 years ago

In 26937:

Pass the $user_id to the admin_color_scheme_picker hook for context.

Prevents the admin color scheme from changing when editing another user.

Merges [26924] to the 3.8 branch.
see #26607.

#14 @nacin
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.