Make WordPress Core

Opened 8 years ago

Last modified 7 days ago

#43796 new defect (bug)

User Role with integer role name not showing in admin filter list

Reported by: aiyaz's profile aiyaz Owned by:
Milestone: Awaiting Review Priority: lowest
Severity: normal Version: 4.9
Component: Users Keywords: reporter-feedback has-patch
Focuses: administration Cc:

Description

When we create a new user role using add_role function and role name is an integer then assign that role to users and that role will not display on top of User listing.

Attachments (1)

Users-filter-issue.png (95.6 KB) - added by aiyaz 8 years ago.
Shows missing role

Download all attachments as: .zip

Change History (4)

@aiyaz
8 years ago

Shows missing role

#1 @johnbillion
8 years ago

  • Keywords reporter-feedback added
  • Priority changed from normal to lowest

What's the use case for using an integer as a role name?

Note that the $role parameter of the add_role() function expects a string.

#2 @aiyaz
8 years ago

Hi John,

Yes, I agree that add_role() expects a string as a parameter but when I passed an integer, the role has been created but when I assigned that role to any users, it doesn't show into the top filter.

actually, I'm looking for this because, I've synchronized user role with external membership API and they are maintaining membership id as an integer so to avoid an alias kind of thing, I need a patch that works with integer and string as a role name in add_role function.

This ticket was mentioned in PR #10721 on WordPress/wordpress-develop by saiyashwanth07.


7 days ago
#3

  • Keywords has-patch added; needs-patch removed

This PR fixes an issue where user roles created with integer keys do not appear in the admin users filter dropdown.

The fix normalizes role keys to strings when building the filter views, ensuring roles created with integer keys are displayed correctly in the Users admin screen.

Trac ticket

https://core.trac.wordpress.org/ticket/43796

Note: See TracTickets for help on using tickets.