WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 3 months ago

#26607 closed defect (bug) (fixed)

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

Reported by: 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 4 months ago.
Hides admin color picker from user profiles that are not the current user.
26607.2.patch (2.2 KB) - added by SergeyBiryukov 4 months ago.
26607.3.patch (688 bytes) - added by SergeyBiryukov 4 months ago.
26607.diff (1.2 KB) - added by nacin 3 months ago.

Download all attachments as: .zip

Change History (18)

comment:1 SergeyBiryukov4 months ago

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

comment:2 rachelbaker4 months ago

  • Cc rachel@… added

rachelbaker4 months ago

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

comment:3 miqrogroove4 months 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?

SergeyBiryukov4 months ago

comment:4 SergeyBiryukov4 months 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.

comment:5 follow-up: nacin4 months 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.

SergeyBiryukov4 months ago

comment:6 in reply to: ↑ 5 ; follow-up: SergeyBiryukov4 months 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.

comment:7 in reply to: ↑ 6 ; follow-up: nacin4 months 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.

comment:8 in reply to: ↑ 7 SergeyBiryukov4 months 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.

comment:9 TobiasBg4 months 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."

comment:10 ircbot3 months ago

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

nacin3 months ago

comment:11 helen3 months ago

In 26924:

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

comment:12 helen3 months ago

  • Keywords fixed-major added

comment:13 nacin3 months 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.

comment:14 nacin3 months ago

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