Hello, appreciating support, you are great people.
I added the snippet to pb-custom.php file, I tried replacing 1 with first_name
621 with last_name
exactly without any modifications but not worked.
<?php
/**
* Change Member Username with Custom Profile Fields.
*/
function yzc_change_member_username_with_custom_fields( $member_name, $user_id ) {
$name = xprofile_get_field_data( first_name, $user_id );
$surname = xprofile_get_field_data( last_name, $user_id );
// Get User Full Name.
$fullname = $name;
if ( ! empty( $surname ) ) {
$fullname .= " " . $surname;
}
if ( empty( $fullname ) ) {
$fullname = $member_name;
}
return $fullname;
}
add_filter( 'bp_core_get_user_displayname', 'yzc_change_member_username_with_custom_fields', 100, 2 );
i think missing something or i could not code fields names right.
-
This reply was modified 3 years, 2 months ago by
mohamettarik.