[wp-hackers] select all users with role X
Denis de Bernardy
denis at semiologic.com
Tue Dec 27 03:48:32 GMT 2005
that's probably not an option with a large list. imho, create and maintain a
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of
> Aaron Brazell
> Sent: Tuesday, December 27, 2005 4:22 AM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] select all users with role X
> On 12/26/05, Scott Merrill <skippy at skippy.net> wrote:
> I'd like to send an email to all the users with the
> Administrator role.
> Since the roles are stored as a serialized array in the
> usermeta table,
> I need to iterate over the entire user table to find all the
> administrators. I _could_ cheat for the time being and use the
> deprecated wp_user_level value, but that's just
> avoiding the issue.
> In many circumstances, iterating over the user table
> won't be a big
> deal, because the number of registered users is so
> small. This is,
> historically, because there is very little value for
> readers to become
> registered users. The newest version of my subscribe2
> plugin is likely
> to change that, and I suspect that some of my users are
> going to see
> some reasonably large user lists. Iterating over these
> to parse each
> array of roles seems like a real waste of an RDBMS.
> Short of re-working the roles and capabilities system,
> does anyone have
> any tricks up their sleeves that might help?
> Hmmmm... without iterating over the user table? Maybe create
> an item in the options table with an array of user ids
> updated whenever a user is added to the admin group? Would
> probably require a one time user table
> scan when the plugin is installed to get all current admins
> and could be added to after that.
> I almost think iterating over the entire table would be more
> worthwhile, but I don't know.
More information about the wp-hackers