Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BUddypress Show Xprofile Field Data in The Profile Header Username.
<?php
/**
* BUddypress Show Xprofile Field Data in The Profile Header Username.
*/
function yzc_add_xprofile_field_data_in_profile_header( $name ) {
if ( bp_is_user() ) {
$field_data = xprofile_get_field_data( 'Age', bp_displayed_user_id() );
if ( ! empty( $field_data ) ) {
return $name . ', <span class="bp-user-age">' . $field_data . '</span>';
}
}
return $name;
}
add_action( 'bp_get_displayed_user_mentionname', 'yzc_add_xprofile_field_data_in_profile_header' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.