I want to show all members of the group in which the user is also member.
For this, I want to use the buddypress members loop:
http://codex.buddypress.org/developer/loops-reference/the-group-members-loop-bp_group_has_members/
As a permitted parameter, I try to get the group_id and start the members loop, but I always get the output “This group has no members.”:
global $bp;
$group = groups_get_group( array( âgroup_idâ => $group_id ) );
if ( bp_group_has_members( '$group' ) ) : ?>
<div id="member-count" class="pag-count">
<?php bp_group_member_pagination_count() ?>
</div>
<div id="member-pagination" class="pagination-links">
<?php bp_group_member_pagination() ?>
</div>
<ul id="member-list" class="item-list">
<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
<li>
<!-- Example template tags you can use -->
<?php bp_group_member_avatar() ?>
<?php bp_group_member_link() ?>
<?php bp_group_member_joined_since() ?>
</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<div id="message" class="info">
<p>This group has no members.</p>
</div>
<?php endif;?>
Have you looked at
function bp_group_has_members
in
buddypressbp-groupsbp-groups-template.php ?
You can’t pass a string ‘$group’ to bp_group_has_members.
Try:
You can Show members of members group by using below code you just have to get id of group by using this method