Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#40168 closed defect (bug) (wontfix)

User roles should be populated in Alphabetical order

Reported by: subrataemfluence Owned by:
Priority: normal Milestone:
Component: Users Version: 2.1
Severity: normal Keywords: has-patch has-screenshots
Cc: Focuses: administration

Description

User role dropdown in user Add and Edit screens should be populated in alphabetical order by default.

Attachments (3)

40168.diff​ (487 bytes ) - added by bor0 10 years ago.
Screenshot from 2017-03-16 18:40:59.png​ (172.7 KB ) - added by subrataemfluence 10 years ago.
List sorted partially. Subscriber is still at the top of everything.
User Role Dropdown.png​ (19.0 KB ) - added by lukecavanagh 10 years ago.
User Role Dropdown after patch

Download all attachments as: .zip

Change History (11)

@bor0
10 years ago

#2 @bor0
10 years ago

  • Keywords has-patch added

#3 @subrataemfluence
10 years ago

  • Keywords reporter-feedback has-screenshots added

Just tried your patch but still it shows "Subscriber" on top of the list while it should come at the bottom of the list. Screenshot added.

#4 @subrataemfluence
10 years ago

  • Keywords reporter-feedback removed

@subrataemfluence
10 years ago

List sorted partially. Subscriber is still at the top of everything.

#5 @bor0
10 years ago

https://core.trac.wordpress.org/ticket/40162 will take care of the issue that's putting the currently selected role on top.

Last edited 10 years ago by bor0 (previous) (diff)

#6 @lukecavanagh
10 years ago

@subrataemfluence

The patch from @bor0 in ticket #40162

Fixes this issue.

@lukecavanagh
10 years ago

User Role Dropdown after patch

#7 @desrosj
10 years ago

  • Keywords dev-feedback added

I'm not sure I agree with alphabetizing the roles in the dropdown. There is an implied hierarchy by the default roles in WordPress. Currently, all dropdowns order roles by least to most capabilities.

#40162 is a bug in that it gives priority to the role of the user being edited, but I think alphabetizing would lose that ordering, which is actually really consistent across all pages right now.

That being said, the patch fixes properly alphabetizes the list for me. I believe that it will only accurately alphabetize the list in English though. The translate_user_role() call in the foreach loop could potentially cause the list to be improperly ordered if the user's language is other than English because translation happens after your sort.

Marking this dev-feedback for another opinion.

#8 @johnbillion
10 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review
  • Resolution → wontfix
  • Status new → closed
  • Version 4.7.3 → 2.1

I also don't think the list of roles should be displayed alphabetically. Plugins can control the way in which roles are displayed via various means, such as the wp_user_roles option, the $wp_roles->roles property, and the editable_roles filter.

Thanks for the suggestion, @subrataemfluence.

Note: See TracTickets for help on using tickets.