How to get a buddypress user profile link and a certain user profile field for the current post author?

I want to replace get_author_link() and get_the_author_meta($feld)

with something equivalent to point to the author of the current post Buddypress user profile page and retrieve a specific profile field from his Buddypress page

ie, I just want to show a link to the post user profile and a biography from one of his BP profile fields

I’m not sure which functions I should use for this… BuddyPress documentation is still not very clear unlike the WP Codex…



For an author’s profile link, use

bp_core_get_user_domain( $user_id )

to get the URL, and

bp_core_get_userlink( $user_id )

to get an HTML link element, including display name.

For the xprofile data, use

xprofile_get_field_data( $field, $user_id )

$field can be either the name of the field (like ‘Biography’) or the numerical field id.

Leave a Comment