Reply To: Users based on location
I am back to start. If there id’s it shows only specific ids but if its null then it shows all the users :s
<?php
$contrytoggle = get_field( "country_toggle" );
$contrypri = get_field( "select_country" ); ?>
<?php echo $contrytoggle; ?>
<?php $custom_ids = my_custom_ids($contrytoggle, $contrypri);
// $has_members_args = array(
// 'include' => $custom_ids,
// );
echo $custom_ids; // it echo no id and still it shows all the users
if ( bp_has_members( $custom_ids ) ) :
?>
<ul>
<?php while ( bp_members() ) : bp_the_member(); ?>
<li>
<div class="item-avatar">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
</div>
<div class="item">
<div class="item-title">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<div id="message" class="info">
<p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
</div>
<?php endif; ?>
</div>