Hi Rourke,
If you just want to list them in the backend, you could use https://wordpress.org/plugins/bbp-manage-subscriptions/
Pascal.
Thanks Pascal,
I’m actually making a shortcode to format a list of users that have the earlier mentioned roles. This shortcode will be used on a page for the front-end.
It’s basically a list of site staff members.
Ah ok,
Then how about:
$mykeymasters = get_users( array('role' => 'keymaster') );
https://codex.wordpress.org/Function_Reference/get_users
Pascal.
But isn’t that for the wordpress roles? Because that returns 0 users.
The roles I’m talking about are the ones you specify at the bottom of a profile page. Forum roles. Apologies if I wasn’t specific enough.
Euh, yes of course.
Can this help you then ?
$user_query_full = new WP_User_Query( array( 'role' => 'bbp_keymaster' ) );
$user_query = $user_query_full->get_results();
var_dump( $user_query );
Pascal.
Ah! The difference was the bbp_keymaster
instead of the keymaster
. This worked for me:
$mykeymasters = get_users( array('role' => 'keymaster') );
Thanks Pascal! You really helped me out here 🙂
Oops, I copy/pasted but forgot to edit the line. This is the correct one for anyone else trying to do this in the future:
$mykeymasters = get_users( array('role' => 'bbp_keymaster') );