xprofile_sync_bp_profile( object $errors, bool $update, object $user )

Syncs the standard built in WordPress profile data to XProfile.

Description

Parameters

$errors

(Required) Array of errors. Passed by reference.

$update

(Required) Whether or not being upated.

$user

(Required) User object whose profile is being synced. Passed by reference.

Source

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

function xprofile_sync_bp_profile( &$errors, $update, &$user ) {

	// Bail if profile syncing is disabled.
	if ( bp_disable_profile_sync() || ! $update || $errors->get_error_codes() ) {
		return;
	}

	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 );
	}

	$user->display_name = bp_custom_display_name_format( $user->display_name, $user->ID );
}

Changelog

Changelog
Version Description
BuddyPress 1.2.4 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.