WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Access Manager
get_users with custom role? (3 posts)

  1. electrolund
    Member
    Posted 1 year ago #

    Hello, I'm testing this plugin with my site. I'm attempting to retrieve a list of users in a newly created role called "approved_authors". I did this by:

    $approved_authors = get_users('role=Approved-author');

    But this string does not contain the data that I expect. Are the custom role handles not usable to get_users?

    http://wordpress.org/extend/plugins/advanced-access-manager/

  2. WP AAM
    Member
    Plugin Author

    Posted 1 year ago #

    Hi electrolund,
    I'm not sure that you are using the get_users function correctly.
    As far as I know, this function expects an array as a first parameter, not a string.

    Regards,
    Vasyl

  3. electrolund
    Member
    Posted 1 year ago #

    Thanks for the reply, Vasyl! According to the codex, one of the valid args of get_users is 'role'

    role - Limit the returned authors to the role specified.

    Example code on the function page:

    $blogusers = get_users('blog_id=1&orderby=nicename&role=subscriber');

    So it would be soooooo nice if your plugin could export the custom user role names. I hope that makes sense.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags