BuddyDev

Search

Access to personal data of users who have disabled member directory visibility

  • Participant
    Level: Initiated
    Posts: 1
    Johannes Dabringhausen on #34467

    Hi there,

    we purchased the Profile Visibility Plugin for our BuddyBoss powered social network some weeks ago and are very happy with it.

    We are currently creating a member map that is supposed to display ALL of our members on a map. This works through a zip code that the users provide in their profile details. The zip code data of the users is currently taken from https://climactivity.de/wp-json/buddyboss/v1/members .

    This way, members who have set their profile visibility settings to “I want to appear in the member’s directory” are appearing on the map with their nick name, but members who have set their profile privacy settings to “I don’t want to appear in the member’s directory” are not appearing. However, we want all of the members to appear in the member map (with the ones with limited visibility only being labelled as “anonymous user”).

    My question is, in the backend, where do we get the zip code data from the users who are not being displayed in the member map, since they do not appear in the upper link I provided?

    Thanks!

    Johannes

  • Keymaster
    (BuddyDev Team)
    Posts: 22178
    Brajesh Singh on #34478

    Hi Johannes,
    Welcome to BuddyDev forums.

    The plugin allows you to flag it for not excluding users.

    you can do that by setting a flag like

    
     bp_profile_visibility_loader()->set_data( 'is_visible' , true );
    

    We need to call it just before the API prepares the items. I will check BuddyBoss’s API and provide you a complete example on how to do it later.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Johannes Dabringhausen on #34563

    Hi Brajesh,

    thank you for your reply! We would appreciate very much if you could help us out with the complete example as you offered.

    Thanks!

    Johannes

  • Keymaster
    (BuddyDev Team)
    Posts: 22178
    Brajesh Singh on #34735

    Hi Johannes,
    My apology for the delayed reply.

    Please put this code in your bp-custom.php

    
    
    /**
     * Do not hide users on any rest route
     */
    add_action( 'rest_api_init', function () {
    
    	if ( ! function_exists( 'bp_profile_visibility_loader' ) ) {
    		return;
    	}
    
    	bp_profile_visibility_loader()->set_data( 'is_visible', true );
    
    } );
    

    This code will not hide users from any of the REST response. I was not able to find a hook for the specific route, so applied it on all routes.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved