Display BuddyPress Profile Fields Anywhere

If you want to echo BuddyPress’s extended profile fields outside the loop, you need to add the $bp->loggedin_user->id parameter.

Here’s the code using a Genesis hook (substitute a hook for your theme):

function show_extra_profile_fields() {
global $bp;
$myfield = xprofile_get_field_data( 'Field Name', $bp->loggedin_user->id );
echo $myfield;
}
add_action( 'genesis_before_loop', 'show_extra_profile_fields' );

Add html tags to the echo statement and you’re in business.

Blessings.

This entry was posted in Featured, WordPress. Bookmark the permalink.

Comments are closed.