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
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 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.