WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#8433 closed enhancement (fixed)

Profile contains options that don't apply to users with "subscriber" role

Reported by: jivany Owned by: Denis-de-Bernardy
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: UI Keywords: has-patch
Focuses: Cc:

Description

For a user with the "subscriber" role, the Profile page contains three options under the "Personal Options" heading:

  • Visual Editor
  • Admin Color Scheme
  • Keyboard Shortcuts

"Visual Editor" does not apply to a subscriber as they cannot write posts. This option does not need to be presented to a subscriber.

"Admin Color Scheme" is redundant as the two options presented to the subscriber are the same (both the "bold" and "subtle" colour options are the same).

"Keyboard Shortcuts" does not apply to a subscriber as they are not able to moderate comments.

Observed in Version 2.7-almost-rc-9965

Attachments (4)

8433.diff (1.8 KB) - added by Denis-de-Bernardy 6 years ago.
user-edit.diff (520 bytes) - added by wnorris 6 years ago.
8433.2.diff (687 bytes) - added by ryan 6 years ago.
8433.3.diff (758 bytes) - added by Denis-de-Bernardy 6 years ago.

Download all attachments as: .zip

Change History (26)

comment:1 @jivany6 years ago

Whoops. "Admin Color Scheme" behaves the same way for a user with "admin" role (both the "bold" and "subtle" colour options are the same). I'm not sure if this is by design or not.

comment:2 @kpdesign6 years ago

  • Cc kpdesign added
  • Component changed from General to UI
  • Keywords admin-ui profile added
  • Owner anonymous deleted

I also would like to see the Personal Options section hidden on the Profile page if the user is assigned to the Subscriber role. There is nothing there that is applicable to a subscriber, and it can be confusing to some users.

comment:3 @janeforshort6 years ago

  • Type changed from defect (bug) to enhancement

The admin color scheme palettes just hadn't been updated yet. If someone can see the admin tool at all, they should have the ability to change their color palette selection if they want to.

comment:4 @kpdesign6 years ago

I agree Jane about the color palette, but the Visual Editor and Keyboard Shortcuts have no functionality for a user at the Subscriber level, and really should not be displayed on the Profile page to anyone who is assigned that role. Is it possible to get that change worked in to 2.8?

comment:5 @janeforshort6 years ago

  • Summary changed from "Dashboard > Profile" Contains options that don't apply to users with "subscriber" role to Profile contains options that don't apply to users with "subscriber" role

If someone will write a patch to remove visual editor and keyboard shortcuts from subscriber role profile, would be nice to have, so users wouldn't wonder what they're for.

comment:6 @janeforshort6 years ago

  • Keywords options needs-patch added; admin-ui removed
  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

@Denis-de-Bernardy6 years ago

comment:7 @Denis-de-Bernardy6 years ago

  • Keywords has-patch tested commit added; profile options needs-patch removed
  • Milestone changed from Future Release to 2.8

comment:8 @Denis-de-Bernardy6 years ago

  • Owner set to Denis-de-Bernardy
  • Status changed from new to accepted

comment:9 @westi6 years ago

Patch broken by change to just use the IS_PROFILE_PAGE in [11359], once fixed works a treat.

comment:10 @westi6 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [11447]) Hide options from users when they don't make any sense for them. Fixes #8433 props Denis-de-Bernardy.

comment:11 @wnorris6 years ago

  • Keywords tested commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

the capabilities 'edit_post' and 'edit_page' expect to be passed a specific post ID. If absent you get notices like:
Notice: Trying to get property of non-object in .../wp-includes/capabilities.php on line 822

The correct capabilities to use are 'edit_posts' and 'edit_pages' (plural). Patch attached.

@wnorris6 years ago

comment:12 follow-up: @ryan6 years ago

The all_post_types filter used in other places. We should drop the filter here since posts and pages (with the "s") aren't post types.

@ryan6 years ago

comment:13 @ryan6 years ago

Quick, untested patch.

comment:14 in reply to: ↑ 12 @Denis-de-Bernardy6 years ago

Replying to ryan:

The all_post_types filter used in other places. We should drop the filter here since posts and pages (with the "s") aren't post types.

Where? I had checked before adding it. :-)

comment:15 @Denis-de-Bernardy6 years ago

Just for info, the reason I had used post and page, rather than posts and pages, was that these filters worked too (I must confess I hadn't checked for the notice), and that made sense to filter that thingy so as to allow plugins to add custom post types if needed.

comment:16 @ryan6 years ago

Actually, it's hierarchical_post_types I was remembering. Regardless, these aren't post types.

@Denis-de-Bernardy6 years ago

comment:17 follow-up: @ryan6 years ago

How about leaving the filter off for now and adding some generic post type registration in 2.9? There are several places where that would be handy.

comment:18 @Denis-de-Bernardy6 years ago

third patch is up with a slightly different approach.

comment:19 in reply to: ↑ 17 @Denis-de-Bernardy6 years ago

Replying to ryan:

How about leaving the filter off for now and adding some generic post type registration in 2.9? There are several places where that would be handy.

Works too, if you don't want it around immediately. In that case, we'd commit 8433.2.diff, and get meet up IRC in early 2.9 to work out where we want them, and ensure we've consistent filter names across the board.

comment:20 @Denis-de-Bernardy6 years ago

Sheesh, it's getting late over here. I can barely write english anymore, and I'm still coding. :D

comment:21 @ryan6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [11477]) Fix notice. Props wnorris. fixes #8433

comment:22 @ryan6 years ago

Went with the most conservative fix for 2.8.

Note: See TracTickets for help on using tickets.