How to add xprofile fields in the members directory
-
Hi everyone
This code below add Age after the username in the members directory.
/**
* 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 );
Please I also want to include City and Country to this code. Can anyone help me modify this code to also include City and Country?
- You must be logged in to reply to this topic.