bp_xprofile_exclude_display_name_profile_fields( array $args )

Removed Display setting field form profile if is disabled on setting page.

Description

Parameters

$args

(Required)

Return

(array)

Source

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

function bp_xprofile_exclude_display_name_profile_fields( $args ){

	// Get the current display settings from BuddyBoss > Settings > Profiles > Display Name Format.
	$current_value = bp_get_option( 'bp-display-name-format' );

	$fields_id = array();

	if ( 'first_name' === $current_value && function_exists( 'bp_hide_last_name') && false === bp_hide_last_name() ) {
		$fields_id[] = bp_xprofile_lastname_field_id();
	}

	if ( 'nickname' === $current_value && function_exists( 'bp_hide_nickname_last_name') && false === bp_hide_nickname_last_name() ) {
		$fields_id[] = bp_xprofile_lastname_field_id();
	}

	if ( 'nickname' === $current_value && function_exists( 'bp_hide_nickname_first_name') && false === bp_hide_nickname_first_name() ) {
		$fields_id[] = bp_xprofile_firstname_field_id();
	}

	$args['exclude_fields'] = $fields_id;

	return $args;
}

Changelog

Changelog
Version Description
BuddyBoss 1.5.1 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.