bp_core_hide_display_name_field( int $field_id )
Whether or not profile field is hidden.
Description
Parameters
- $field_id
-
(Required) ID for the profile field.
Return
(bool) Whether or not profile field is hidden.
Source
File: bp-core/bp-core-functions.php
4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 | function bp_core_hide_display_name_field( $field_id = 0 ) { if ( ! function_exists( 'bp_is_active' ) || ! bp_is_active( 'xprofile' ) || empty ( $field_id ) ) { return false; } $retval = false; // Get the current display settings from BuddyBoss > Settings > Profiles > Display Name Format. $current_value = bp_get_option( 'bp-display-name-format' ); // If First Name selected then do not add last name field. if ( 'first_name' === $current_value && $field_id === bp_xprofile_lastname_field_id() ) { if ( function_exists( 'bp_hide_last_name' ) && false === bp_hide_last_name() ) { $retval = true; } // If Nick Name selected then do not add first & last name field. } elseif ( 'nickname' === $current_value && $field_id === bp_xprofile_lastname_field_id() ) { if ( function_exists( 'bp_hide_nickname_last_name' ) && false === bp_hide_nickname_last_name() ) { $retval = true; } } elseif ( 'nickname' === $current_value && $field_id === bp_xprofile_firstname_field_id() ) { if ( function_exists( 'bp_hide_nickname_first_name' ) && false === bp_hide_nickname_first_name() ) { $retval = true; } } /** * Filters Hide Display name field. * * @since BuddyBoss 1.4.7 * * @param bool $retval Return value. * @param int $field_id ID for the profile field. */ return ( bool ) apply_filters( 'bp_core_hide_display_name_field' , $retval , $field_id ); } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.7 | 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.