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

1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
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.