WordPress.org

Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#48459 new defect (bug)

Unable to list users with 'No role for this site'

Reported by: ahall41 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.4
Component: Users Keywords:
Focuses: administration Cc:
PR Number:

Description

I noticed that I had one user registered on my site with 'No role' in the summary. However, clicking on 'No Role' lists all ? users, rather than the one I wanted [so I could remove it]. The only way to find it was to page through all the users (in my case the 3rd) until I found one with a role of 'None'.

To reproduce: Create a user; Edit the user and set role to 'No role for this site'; List all users; Click on 'No role' in the summary. This should display just the one user?

[Is it significant the summary shows as 'No role' but the listing shows 'None']

Attachments (1)

No Role.png (123.9 KB) - added by ahall41 3 weeks ago.
Screen image

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
3 weeks ago

  • Component changed from General to Users
  • Focuses administration added

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Adding some links to previous related tickets, for reference: #22993, #36196, #38851.

#2 @johnbillion
3 weeks ago

@ahall41 Is this on a Multisite installation or a single site installation?

#3 @ahall41
3 weeks ago

This is single site ... its perhaps more subtle than I first thought ...

I have a custom role (created with Advanced Access Manage) which (I assume - its a while ago) was inherited from No Role. Its these users which are appearing together with No Role in the No Role list.

Although I did today create a new role, again inherited from No Role, which does not appear in this list ...

Please see attached image

@ahall41
3 weeks ago

Screen image

#4 @ahall41
3 weeks ago

I've been doing a bit of digging. In wp_get_users_with_no_role, the call to wp_roles()->get_names() is including "ddatower" in the list. However the actual capability in the user metadata is "dda tower", as a result the not regexp 'administrator|editor|author|contributor|subscriber|bellrepairfund|ddatower' is failing to exclude "dda tower".

I should also point out that this list does not include "ddaauthor" or "dda author".

[Why not just look for an empty capability here?]

Note: See TracTickets for help on using tickets.