bp_xprofile_remove_bp_xprofile_change_field_visibility( bool $user_can, int $user_id, string $capability )
Remove the ‘bp_xprofile_change_field_visibility’ cap based on display name format.
Description
Parameters
- $user_can
-
(Required)
- $user_id
-
(Required)
- $capability
-
(Required)
Return
(bool)
Source
File: bp-xprofile/bp-xprofile-caps.php
function bp_xprofile_remove_bp_xprofile_change_field_visibility( $user_can, $user_id, $capability ) { if ( empty( $GLOBALS['profile_template'] ) ) { return $user_can; } $field_id = bp_get_the_profile_field_id(); if ( $field_id ) { $first_name_id = bp_xprofile_firstname_field_id(); $last_name_id = bp_xprofile_lastname_field_id(); $nick_name_id = bp_xprofile_nickname_field_id(); $display_name_format = bp_core_display_name_format(); if ( $field_id === $nick_name_id ) { $user_can = false; } if ( 'first_last_name' === $display_name_format ) { if ( $field_id && in_array( $field_id, array( $first_name_id ) ) ) { $user_can = false; } } elseif ( 'first_name' === $display_name_format ) { if ( $field_id && in_array( $field_id, array( $first_name_id ) ) ) { $user_can = false; } } } return $user_can; }
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.