BuddyDev

Search

[Resolved] Profile Visibility Manager not hiding profiles

  • Participant
    Level: Initiated
    Posts: 2
    Ian Brodie on #38409

    Hi – I’ve installed the Profile Visibility Manager plugin and have a couple of users with profiles set to not show anywhere – yet they can still be seen.

    The main place we want them invisible is the Group member list but they’re all visible.

    Any ideas?

  • Keymaster
    (BuddyDev Team)
    Posts: 18454
    Brajesh Singh on #38442

    Hi Ian,
    Thank you for using the plugin.

    At the moment, this is by design for non public groups. For public groups, they should be hidden based on their preference.

    Do you want to enforce it for non public groups too? I can supply a line of code for the same. Please let me know.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    Ian Brodie on #38480

    Yes please.

    In fact all we really want is for the group organiser to be invisible so the group member list is just the actual members. Thought we could do it using the plugin and having the organiser hide their profile.

  • Keymaster
    (BuddyDev Team)
    Posts: 18454
    Brajesh Singh on #38489

    Hi Ian,
    Thank you.

    Please put this code in your child theme’s functions.php or in wp-content/plugins/bp-custom.php

    
    
    /**
     * Reset flag for group members list.
     */
    function bp_profile_visibility_custom_reset_conditions_for_group() {
    
    	if ( function_exists( 'bp_profile_visibility_loader' ) ) {
    		bp_profile_visibility_loader()->set_data( 'is_visible', false );
    	}
    
    }
    
    add_action( 'bp_before_group_body', 'bp_profile_visibility_custom_reset_conditions_for_group', 100 );
    add_action( 'bp_before_group_membership_requests_admin', 'bp_profile_visibility_custom_reset_conditions_for_group', 100 );
    
    /* for nouveau, we need to use the filter instead*/
    add_filter( 'bp_after_group_has_members_parse_args', function ( $args ) {
    
    	if ( empty( $args['group_id'] ) || ! function_exists( 'bp_profile_visibility_loader' ) ) {
    		return $args;
    	}
    
    	bp_profile_visibility_loader()->set_data( 'is_visible', false );
    
    	return $args;
    }, 100 );
    
    

    That will do it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    Ian Brodie on #38544

    That worked perfectly, thanks Brajesh.

    Might be an idea to include this as maybe a checkbox option for “enable for private groups” in the next version of the plugin?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 18454
    Brajesh Singh on #38548

    Hi Ian,
    Thank you for confirming.

    Sure, that we will be glad to add it in our future update.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved
Subscribe