Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group Members Loop

The group members loop can be used to display members that have joined a group. It can be used nested inside the bp_has_groups() loop, or on its own with a group_id parameter.

Standard Loop

<?php if ( bp_group_has_members() ) : ?>

  <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;?>

Accepted Parameters

The bp_group_has_members() function will accept a number of parameters that will manipulate the data being returned.

Advanced Usage

Fetch all the members from the group with ID 15 and show 10 per page.

<php if ( bp_group_has_members( 'group_id=15&per_page=10' ) ) : ?>