bp_core_map_user_registration( int $user_id )

Map a user’s WP display name to the XProfile fullname field, if necessary.


Description Description

This only happens when a user is registered in wp-admin by an administrator; during normal registration, XProfile data is provided directly by the user.


Top ↑

Parameters Parameters

$user_id

(int) (Required) ID of the user.


Top ↑

Return Return

(bool)


Source Source

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

function bp_core_map_user_registration( $user_id ) {

	// Only map data when the site admin is adding users, not on registration.
	if ( ! is_admin() ) {
		return false;
	}

	// Add the user's fullname to Xprofile.
	if ( bp_is_active( 'xprofile' ) ) {
		$firstname = bp_get_user_meta( $user_id, 'first_name', true );
		$lastname = ' ' . bp_get_user_meta( $user_id, 'last_name', true );
		$name = $firstname . $lastname;

		if ( empty( $name ) || ' ' == $name ) {
			$name = bp_get_user_meta( $user_id, 'nickname', true );
		}

		xprofile_set_field_data( 1, $user_id, $name );
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.