Skip to:
Content

BuddyPress.org

Ticket #7391: 7391.diff

File 7391.diff, 724 bytes (added by boonebgorges, 3 years ago)
  • src/bp-xprofile/bp-xprofile-caps.php

    diff --git src/bp-xprofile/bp-xprofile-caps.php src/bp-xprofile/bp-xprofile-caps.php
    index f34925f..e93c748 100644
    add_filter( 'bp_map_meta_caps', 'bp_xprofile_map_meta_caps', 10, 4 ); 
    8484 */
    8585function bp_xprofile_grant_bp_xprofile_change_field_visibility_for_logged_out_users( $user_can, $user_id, $capability ) {
    8686        if ( 'bp_xprofile_change_field_visibility' === $capability && 0 === $user_id ) {
    87                 $user_can = true;
     87                $field_id = bp_get_the_profile_field_id();
     88                if ( $field_id && $field = xprofile_get_field( $field_id ) ) {
     89                        $user_can = 'allowed' === $field->allow_custom_visibility;
     90                }
    8891        }
    8992
    9093        return $user_can;