我想显示用户也是成员的组的所有成员。为此,我想使用 buddypress 成员循环: http ://codex.buddypress.org/developer/loops-reference/the-group-members-loop-bp_group_has_members/
作为允许的参数,我尝试获取 group_id 并启动成员循环,但我总是得到输出“此组没有成员。”:
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;?>