Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show Buddypress Xprofile Field Data After The username in The Members Directory.
<?php
/**
* Show Xprofile Field Data After The username in The Members Directory.
*/
function yzc_add_xprofile_field_data_after_username( $name ) {
if ( bp_is_members_directory() ) {
$field_data = xprofile_get_field_data( 'Age', bp_get_member_user_id() );
return $name . ', <span class="bp-user-age">' . $field_data. '</span>';
}
return $name;
}
add_filter( 'bp_member_name', 'yzc_add_xprofile_field_data_after_username', 10 );
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.