Skip to:
Content

BuddyPress.org

Ticket #5317: bp-xprofile-functions.php.patch

File bp-xprofile-functions.php.patch, 1.3 KB (added by megainfo, 11 years ago)

bp-xprofile-functions.php patch

  • bp-xprofile-functions.php

     
    712712
    713713                // If the current user and displayed user are friends, show all
    714714                } elseif ( bp_is_active( 'friends' ) && friends_check_friendship( $displayed_user_id, $current_user_id ) ) {
    715                         $hidden_levels = array( 'adminsonly', );
     715                        $hidden_levels = array( 'onlyme' );
    716716
    717717                // current user is logged in but not friends, so exclude friends-only
    718718                } else {
    719                         $hidden_levels = array( 'friends', 'adminsonly', );
     719                        $hidden_levels = array( 'friends', 'onlyme' );
    720720                }
    721721
    722         // Current user is not logged in, so exclude friends-only, loggedin, and adminsonly.
     722                // current user is not an admin
     723                if( !bp_current_user_can( 'bp_moderate' ) ){
     724                        $hidden_levels[] = 'adminsonly';
     725                }
     726
     727        // Current user is not logged in, so exclude friends-only, loggedin, onlyme and adminsonly.
    723728        } else {
    724                 $hidden_levels = array( 'friends', 'loggedin', 'adminsonly', );
     729                $hidden_levels = array( 'friends', 'loggedin', 'adminsonly', 'onlyme' );
    725730        }
    726731
    727         return $hidden_levels;
     732        // filter the visibility levels
     733        return apply_filters( 'bp_xprofile_get_hidden_field_types_for_user', $hidden_levels, $displayed_user_id, $current_user_id );
    728734}
    729735
    730736/**