Is there a way I can list all the users from a new role I’ve made?
I just want to output a list on a page called “Artists”
Yes, if you created a new role, you have to go to Community profiles settings and mark it to show.
Thanks for your response Txanny…
So.. on top of having the regular subscriber role listings of all the comunity members, I could have a separate page with only the people marked as “Artist” and list all of them and their avatars etc?
Is that possible with your solution above?
Thanks so much! Amazing plugin and something WP really lacks
No, by now you have only one page for all users. You cannot have different pages by roles. This will be considered to be included in a future release.
Actually Txanny, I achieved this very thing. All I did was make a role called “ARTIST”, so this might help you for coding that out:
Check it out over at http://riptapparel.com/community http://riptapparel.com/artists
<?php $roles = array('artist');
/* Loop through users to search for the admin and editor users. */
foreach( $roles as $role )
{
// all users with artist role
if($role == 'artist')
{
$this_role = "'[[:<:]]".$role."[[:>:]]'";
$query = "SELECT * FROM $wpdb->users WHERE ID = ANY (SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'wp_capabilities' AND meta_value RLIKE $this_role) ORDER BY user_nicename ASC LIMIT 10000";
$users_of_this_role = $wpdb->get_results($query);
if ($users_of_this_role)
{
foreach($users_of_this_role as $user)
{
$curuser = get_userdata($user->ID);
$author_post_url=get_author_posts_url($curuser->ID, $curuser->nicename);
echo "<ul class='userList'>";
echo "<li>";
echo "<a href='/community/user/$curuser->nickname' title='.$curuser->display_name'>";
echo get_avatar($curuser->user_email, '50', $avatar);
echo '</a>';
echo "<a href='/community/user/$curuser->nickname' title='.$curuser->display_name'>";
echo "<p>$curuser->display_name</p>";
echo '</a>';
//echo '<p>'.$curuser->description.'</p>';
echo '</li>';
echo '</ul>';
}
}
}
}
?>