BuddyDev

Search

[Resolved] Some help needed with xProfile field privacy


  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26067

    Hi Brajesh,

    I’m now using your sample plugin…
    https://github.com/buddydev/extended-xprofile-field-visibility-levels
    …that way we have the new visibility level «My Group Members» (btw: very good idea!).

    I use it in combination with this code:

    
    
    function my_directory() {	
    if ( bp_is_active( 'xprofile' ) )
    
    	if ( $memberbio = xprofile_get_field_data( 'Kurzbiografie', bp_get_member_user_id() ) ) :
    		echo '<br/>';		
    		echo $memberbio;
    		echo '</div>';
    	endif;
    	
    	if ( $memberinfo = xprofile_get_field_data( 'Telefon', bp_get_member_user_id() ) ) :		
    		echo $memberinfo;
    		echo '</div>';
    	endif;
    
    }
    add_filter ( 'bp_directory_members_item', 'my_directory' );
    
    

    But “Telefon” (phone no) with visibility setting «My Group Members» is visible for a non-group-member.

    What do I have to include in the code to make sure that the privacy setting is honored?

    Thanks for help, Hans


  • Keymaster
    (BuddyDev Team)
    Posts: 14737
    Brajesh Singh on #26072

    Hi Hans,
    This is expected behaviour.

    BuddyPress does not enforce profile field visibility if you are using xprofile_get_field_data.

    The visibility is only enforced in the view/edit profile page. This is how BuddyPress works.

    Regards
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26073

    Hi Brajesh,
    Thanks for your help. Always good to know that somebody knows how it’s working «backstage».

    Best wishes,
    Hans

You must be logged in to reply to this topic.

This topic is: resolved
Subscribe