Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@imath
Last active December 22, 2019 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/67c2c5d961083bc8d4205860a2a075b2 to your computer and use it in GitHub Desktop.
Save imath/67c2c5d961083bc8d4205860a2a075b2 to your computer and use it in GitHub Desktop.
Display profile field within BP Nouveau using the template hierarchy. Put the following into a /buddypress/members/ subfolder of your theme and replace `Name of your xProfile field` with the name of your profile field :)
<?php
/**
* BuddyPress - Members Loop
*
* @since 3.0.0
* @version 3.0.0
*/
bp_nouveau_before_loop(); ?>
<?php if ( bp_get_current_member_type() ) : ?>
<p class="current-member-type"><?php bp_current_member_type_message(); ?></p>
<?php endif; ?>
<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
<?php bp_nouveau_pagination( 'top' ); ?>
<ul id="members-list" class="<?php bp_nouveau_loop_classes(); ?>">
<?php while ( bp_members() ) : bp_the_member(); ?>
<li <?php bp_member_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_member_user_id(); ?>" data-bp-item-component="members">
<div class="list-wrap">
<div class="item-avatar">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar( bp_nouveau_avatar_args() ); ?></a>
</div>
<div class="item">
<div class="item-block">
<h2 class="list-title member-name">
<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
</h2>
<?php if ( bp_nouveau_member_has_meta() ) : ?>
<p class="item-meta last-activity">
<?php bp_nouveau_member_meta(); ?>
</p><!-- #item-meta -->
<?php endif; ?>
<div style="clear: both;">
<?php bp_member_profile_data( 'field=Name of your xProfile field' ); ?>
</div>
<?php
bp_nouveau_members_loop_buttons(
array(
'container' => 'ul',
'button_element' => 'button',
)
);
?>
</div>
<?php if ( bp_get_member_latest_update() && ! bp_nouveau_loop_is_grid() ) : ?>
<div class="user-update">
<p class="update"> <?php bp_member_latest_update(); ?></p>
</div>
<?php endif; ?>
</div><!-- // .item -->
</div>
</li>
<?php endwhile; ?>
</ul>
<?php bp_nouveau_pagination( 'bottom' ); ?>
<?php
else :
bp_nouveau_user_feedback( 'members-loop-none' );
endif;
?>
<?php bp_nouveau_after_loop(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment