Forums

Search users by roles and/or capabilities (3 posts)

  1. LucasMS
    Member
    Posted 4 months ago #

    I'm looking for a way to search users with a certain role or capability, but this information is stored serialized in the database, and build a query using "like" would take too much time in a large database.

    I dont want to retrieve the entire user table and then check each one. Any ideas?

    thank you

  2. MichaelH
    moderator
    Posted 4 months ago #

    Not what you wanted but I'm not sure there is something to meet your criteria:

    Return users of the editor role
    SELECT wpusers.*
    FROM wp_users wpusers, wp_usermeta wpusermeta
    WHERE wpusers.ID = wpusermeta.user_id
    AND wpusermeta.meta_key = 'wp_capabilities'
    AND wpusermeta.meta_value RLIKE '[[:<:]]editor[[:>:]]'
    ORDER BY wpusers.user_nicename ASC

    Also note changes in the works:
    https://core.trac.wordpress.org/ticket/10201

  3. anmari
    Member
    Posted 3 months ago #

    My plugin recently launched at the http://weblogtoolscollection.com/pluginblog/2009/07/31/amr-users-plugin-for-user-lists-and-reporting/
    ia aimed at exactly that sort of problem.

    It is a fairly "fresh" plugin, tested, but not yet on very large volumes, so I'd like to know how it goes - I had some ideas for cacheing if there was a problem.

    It is very configurable and I'd be intereseted to see what you think. If it is useful to you, please rate it at the weblogtoolscollection.com site and at wordpress http://wordpress.org/extend/plugins/amr-users/

Reply

You must log in to post.

About this Topic