Opened 5 months ago

Last modified 5 months ago

#22993 new defect (bug)

Admin - users without a role are difficult to find

Reported by: logikal16 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Users Version: 3.5
Severity: normal Keywords: needs-patch ux-feedback
Cc: mdhansen@…

Description

There doesn't appear to be a filter to display users *without* a role (see the screenshot). The ideal solution would be to add a filter for "None".

http://i.imgur.com/3S5pH.png

Change History (9)

  • Cc mdhansen@… added
  • Keywords close added

I think the only way you could get a user without a role would be through a plugin. I would think these plugins should create a role(without capabilities if necessary) if they do not wish to use one of the existing roles. Then their custom role would be able to be filtered.

Last edited 5 months ago by MikeHansenMe (previous) (diff)

comment:2 follow-up: ↓ 4   markoheijnen5 months ago

  • Keywords ux-feedback added; dev-feedback close removed

Thats incorrect. You can do it through the interface of WordPress but I'm curious if we should check on it.

WP core allows for users without roles, hence this should be core territory. On sites with thousands of users, the ability to find users without roles is important.

IMO, there's no reason why a role filter couldn't get added, and live beside the existing text filters, e.g.

Administrator (440) | Subscriber (50) | No Role (25)

Patch coming soon...

comment:4 in reply to: ↑ 2 ; follow-up: ↓ 5   MikeHansenMe5 months ago

Replying to markoheijnen:

Thats incorrect. You can do it through the interface of WordPress but I'm curious if we should check on it.

Where are you able to add a user without a role? I attempted to manually add a user via Users -> Add New and it makes you select a role.

For allowing anyone to register. The option on Settings -> General makes you select a default role.

I am just curious because I am unaware of it.

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6   helen5 months ago

Replying to MikeHansenMe:

Where are you able to add a user without a role?

Not add, but you can set "No role for this site" from their profile.

comment:6 in reply to: ↑ 5   MikeHansenMe5 months ago

Replying to helen:

Replying to MikeHansenMe:

Where are you able to add a user without a role?

Not add, but you can set "No role for this site" from their profile.

Thanks, I was unaware of this. I am all for adding a link to filter users without roles then.

The first issue is within count_users(). By default, it uses a LIKE query to see if the current role is within the serialized wp_capabilities array. For users without roles, this won't work.

  • A subscriber: a:1:{s:10:"subscriber";b:1;}
  • A user with no role: a:0:{}

comment:8 follow-up: ↓ 9   markoheijnen5 months ago

Thats shouldn't be a problem since the value is always the same so we can check on the value "a:0:{}"

comment:9 in reply to: ↑ 8   nacin5 months ago

Replying to markoheijnen:

Thats shouldn't be a problem since the value is always the same so we can check on the value "a:0:{}"

Unless the user has a single capability (no role).

Note: See TracTickets for help on using tickets.