bp_xprofile_sync_bp_profile( int $user_id )

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

Description

Parameters

$user_id

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

Return

(void)

Source

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

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.