Skip to:
Content

BuddyPress.org

Ticket #5192: 5192.bp_xprofile_get_hidden_fields_for_user.patch

File 5192.bp_xprofile_get_hidden_fields_for_user.patch, 1.3 KB (added by imath, 9 years ago)
  • src/bp-xprofile/bp-xprofile-functions.php

    diff --git src/bp-xprofile/bp-xprofile-functions.php src/bp-xprofile/bp-xprofile-functions.php
    index d84f029..0e3b88f 100644
    function bp_xprofile_get_hidden_fields_for_user( $displayed_user_id = 0, $curren 
    10221022                $displayed_user_id = bp_displayed_user_id();
    10231023        }
    10241024
    1025         if ( !$displayed_user_id ) {
    1026                 return array();
    1027         }
     1025        // Default to empty array
     1026        $hidden_fields = array();
    10281027
    1029         if ( !$current_user_id ) {
    1030                 $current_user_id = bp_loggedin_user_id();
    1031         }
     1028        if ( $displayed_user_id ) {
     1029                if ( !$current_user_id ) {
     1030                        $current_user_id = bp_loggedin_user_id();
     1031                }
    10321032
    1033         // @todo - This is where you'd swap out for current_user_can() checks
    1034         $hidden_levels = bp_xprofile_get_hidden_field_types_for_user( $displayed_user_id, $current_user_id );
    1035         $hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
     1033                // @todo - This is where you'd swap out for current_user_can() checks
     1034                $hidden_levels = bp_xprofile_get_hidden_field_types_for_user( $displayed_user_id, $current_user_id );
     1035                $hidden_fields = bp_xprofile_get_fields_by_visibility_levels( $displayed_user_id, $hidden_levels );
     1036        }
    10361037
    10371038        /**
    10381039         * Filters the ids of fields that are hidden for this displayed/loggedin user pair.