bp_xprofile_sync_bp_profile( int $user_id )

Sync the standard built in WordPress profile data to xprofile data.

Description

Parameters

$user_id

(Required) sync specified user id first name, last name and nickname.

Return

(void)

Source

File: bp-xprofile/bp-xprofile-functions.php

1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
function bp_xprofile_sync_bp_profile( $user_id ) {
 
    if ( empty( $user_id ) ) {
        return;
    }
 
    $user = get_user_by( 'id', $user_id );
 
    if ( isset( $user->first_name ) ) {
        xprofile_set_field_data( bp_xprofile_firstname_field_id(), $user->ID, $user->first_name );
    }
 
    if ( isset( $user->last_name ) ) {
        xprofile_set_field_data( bp_xprofile_lastname_field_id(), $user->ID, $user->last_name );
    }
 
    if ( isset( $user->nickname ) ) {
        xprofile_set_field_data( bp_xprofile_nickname_field_id(), $user->ID, $user->nickname );
    }
 
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.7 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.