$subscribers = get_users( 'fields=ID&role=subscriber' );
$subscribers
will be an array of just the IDs of all subscribers.
https://codex.wordpress.org/Function_Reference/get_users
thanks, this gets me the members that i want – i’m trying to put this in the members-loop
this is failing to get some of the members for some reason:
while ( bp_members() ) : bp_the_member();
$user = new WP_User( bp_get_member_user_id() );
if ($user->roles[0] == 'subscribers') :
this gets me all of them, but when i put it in the loop, it repeats the “students” each number of members
while ( bp_members() ) : bp_the_member();
$subscribers = get_users( 'fields=ID&role=subscribers' );
?>
<li class="kleo-masonry-item">
<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">
<div class="item-avatar rounded">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
<?php do_action('bp_member_online_status', bp_get_member_user_id()); ?>
</div>
[ ................. ]
would you mind giving me a hand getting this looped properly with the correct member data? i’d sure appreciate it – it’s been a year or so since i was really immersed in PHP and i don’t know BP at all…
thanks so much
GN