Search code examples
wordpressbuddypress

Buddypress check field visibility


I need to access some of the Buddypress custom profile fields. I can get the field data using xprofile_get_field_data but I want to honor the visibility settings.

Is there a Buddypress function which will determine if the current user is allowed to see the profile field of the displayed user?


Solution

  • Try:

    $visibility_levels = get_user_meta( $user_id, 'bp_xprofile_visibility_levels', true );
    

    It should return an array from which you can check the settings for a particular field.