WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#43796 new defect (bug)

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

Reported by: aiyaz Owned by:
Milestone: Awaiting Review Priority: lowest
Severity: normal Version: 4.9
Component: Users Keywords: needs-patch reporter-feedback
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 2 months ago.
Shows missing role

Download all attachments as: .zip

Change History (3)

@aiyaz
2 months ago

Shows missing role

#1 @johnbillion
2 months 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
2 months 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.

Note: See TracTickets for help on using tickets.