Restricting the ‘if’ not the ‘while’ in bp_has_members
-
Hi there,
I’ve been trying to get bp_has_members to just output members with the role of moderator. This works to do that:
`
<?php while ( bp_members() ) : bp_the_member();
$user = new WP_User( bp_get_member_user_id() );
if ( $user->roles[0] == ‘moderator’ ) :
?>`The problem seems to be that it returns the full list of members, but then just doesn’t display the ones that aren’t moderators. I’m new to BuddyPress and know that normally I would apply that filter to moderator in wp_query on the ‘if’ statement, not the ‘while’. But I’m not sure how to go about changing the query in BuddyPress. Any thoughts? Many thanks.
- The topic ‘Restricting the ‘if’ not the ‘while’ in bp_has_members’ is closed to new replies.