[wp-hackers] Get All Users with Specific capability

Andrew Nacin wp at andrewnacin.com
Wed Feb 16 04:18:01 UTC 2011


On Tue, Feb 15, 2011 at 7:48 PM, Jeremy Clarke <jer at simianuprising.com>wrote:

> In 3.1 you can use get_users('role=subscriber') to avoid using any custom
> SQL but like you say that is not usually good enough and capabilities are
> fundamentally more useful and important in WP (especially in public plugins
> where you can't make any assumptions about roles).
>
> IMHO get_users() should be able to take in a capability as well as roles,
> too bad that wasn't included in 3.1. It's certainly a complicated problem,
> but it doesn't seem impossible, just potentially irresponsible WRT server
> performance (you'd want to cache it if you use it on most pageloads).


The solution here is to move away from a schema where users are given
capabilities directly.

Currently dormant Trac ticket: http://core.trac.wordpress.org/ticket/10201

While we're not sure when it'll be implemented, most of us are inclined to
implement the proposal outlined in detail here:
http://andrewnacin.com/2010/04/03/overhauling-roles-and-capabilities-part-2/

Cheers,
Nacin


More information about the wp-hackers mailing list