BuddyDev

Search

[Resolved] BP Profile Visibility Manager

  • Participant
    Level: Initiated
    Posts: 1
    Tom Davis on #4257

    Installed Profile Visibility Manager plugin and it works great. Our main goal was that we needed to be able to hide some profiles completely while keeping those people as users. Being able to hide their profiles from member search was also important. But we still need to be able to have admin level users search all profiles regardless of their visibility settings. Is this possible?

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #4262

    Hi Tom,
    Welcome to BuddyDev.

    Please put this code in your bp-custom.php or your theme’s functions.php

    
    
    function buddydev_disable_filtering_users() {
    	
    	if ( function_exists( 'bp_profile_visibility_loader' ) && current_user_can( 'manage_options' ) ) {
    		bp_profile_visibility_loader()->set_data( 'is_visible', true );//all users will be visible
    	}
    }
    add_action( 'bp_before_members_loop', 'buddydev_disable_filtering_users' );
    
    //do you want to disable visibility after the loop?
    function buddydev_reenable_filtering_users() {
    	
    	if ( function_exists( 'bp_profile_visibility_loader' ) && current_user_can( 'manage_options' ) ) {
    		bp_profile_visibility_loader()->set_data( 'is_visible', false );//all users will be visible according to their preference
    	}
    }
    add_action( 'bp_after_members_loop', 'buddydev_reenable_filtering_users' );
    
    

    It is the simplest way to enable/disable filtering.

    The current_user_can() function takes capability for checking. For the Capabilities, Please see https://codex.wordpress.org/Roles_and_Capabilities

    Please do let me know if it works for you or not?

  • Participant
    Level: Initiated
    Posts: 1
    Tom Davis on #4293

    This worked perfectly. Only Administrator level users can see all profiles that are set to “Only Me (Private)” Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #4301

    Thank you Tom 🙂

The topic ‘ [Resolved] BP Profile Visibility Manager’ is closed to new replies.

This topic is: resolved