xprofile_override_user_fullnames()

Replace the displayed and logged-in users fullnames with the xprofile name, if required.


Description Description

The Members component uses the logged-in user’s display_name to set the value of buddypress()->loggedin_user->fullname. However, in cases where profile sync is disabled, display_name may diverge from the xprofile fullname field value, and the xprofile field should take precedence.

Runs at bp_setup_globals:100 to ensure that all components have loaded their globals before attempting any overrides.


Source Source

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

function xprofile_override_user_fullnames() {
	// If sync is enabled, the two names will match. No need to continue.
	if ( ! bp_disable_profile_sync() ) {
		return;
	}

	if ( bp_loggedin_user_id() ) {
		buddypress()->loggedin_user->fullname = bp_core_get_user_displayname( bp_loggedin_user_id() );
	}

	if ( bp_displayed_user_id() ) {
		buddypress()->displayed_user->fullname = bp_core_get_user_displayname( bp_displayed_user_id() );
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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