Created
August 7, 2012 11:28
-
-
Save amrvignesh/3284653 to your computer and use it in GitHub Desktop.
The Members Loop / bp_has_members()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( bp_has_members() ) : ?> | |
<div class="pagination"> | |
<div class="pag-count" id="member-dir-count"> | |
<?php bp_members_pagination_count() ?> | |
</div> | |
<div class="pagination-links" id="member-dir-pag"> | |
<?php bp_members_pagination_links() ?> | |
</div> | |
</div> | |
<?php do_action( 'bp_before_directory_members_list' ) ?> | |
<ul id="members-list" class="item-list"> | |
<?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> | |
<?php if ( bp_get_member_latest_update() ) : ?> | |
<span class="update"> - <?php bp_member_latest_update( 'length=10' ) ?></span> | |
<?php endif; ?> | |
</div> | |
<div class="item-meta"><span class="activity"><?php bp_member_last_active() ?></span></div> | |
<?php do_action( 'bp_directory_members_item' ) ?> | |
<?php | |
/*** | |
* If you want to show specific profile fields here you can, | |
* but it'll add an extra query for each member in the loop | |
* (only one regadless of the number of fields you show): | |
* | |
* bp_member_profile_data( 'field=the field name' ); | |
*/ | |
?> | |
</div> | |
<div class="action"> | |
<?php do_action( 'bp_directory_members_actions' ) ?> | |
</div> | |
<div class="clear"></div> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
<?php do_action( 'bp_after_directory_members_list' ) ?> | |
<?php bp_member_hidden_fields() ?> | |
<?php else: ?> | |
<div id="message" class="info"> | |
<p><?php _e( "Sorry, no members were found.", 'buddypress' ) ?></p> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Members Loop / bp_has_members()
Codex Home → Developer Docs → Custom BuddyPress Loops → The Members Loop / bp_has_members()
The site members loop can be used to output a list of users that are registered on your site.