• Resolved Peter Berger

    (@peterpolow)


    Hi Eliot,

    I’m trying to display the names of users with different roles in one loop. For example: I want to display the users with the role admin or author.

    A loop for just one role works fine (also with a custom role created with the Members plugin from Justin).

    [users role=admin]
    [user nickname]
    [/users]

    But this doesn’t work:

    [users role=admin,author]
    [user nickname]
    [/users]

    I get it done with the code below (because the roles of the users I want to display has the capability “upload_files” in common).

    [users exclude=5,8]
    [is capable=upload_files]
    [user nickname]
    [/is]
    [/users]

    But it would be nice if I can select multiple roles in one user loop.
    Is it easy for you to make this possible?

    Thanks (again, again and again) in advance!

    Peter

    https://wordpress.org/plugins/custom-content-shortcode/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hi Peter,

    Sorry for the late response, and thank you for pitching in to help some people on the support forum. I was caught up in some busy-ness the last few weeks, but I’m back.

    In the latest plugin update, I added support for querying multiple user roles. Apparently WP_Query doesn’t support it, so the users loop performs query for each role, then combines the result.

    Thread Starter Peter Berger

    (@peterpolow)

    Nice work (as usual). I tested it and it works as expected. Thanks a lot!

    Please, don’t say sorry. I don’t expect you to response quick. I appreciate any effort you provide to the plugin.

    Peter

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Select multiple roles in users loop’ is closed to new replies.