This topic has 24 replies, 4 voices, and was last updated 7 years by Laura.

  • Author
  • #82714
     mtgame21
    Participant

    Using Buddypress. What is the recommended way to hide specific accounts from appearing in the Members Directory. The two scenarios would be:
    1. hiding admin accounts from appearing on a member directory search results page
    2. Have two PMPro membership levels. Basic account, you don’t show up on a member directory search results page. For the Premium account, you do show up in search results.

    Is there a plugin that might help with either or both of these scenarios?

    #82894
     Laura
    Moderator

    Hello, for the admin:
    Add this to child theme functions.php
    1. – Deny access to admins profile

    COPY CODE
    
    // deny access to admins profile. User is redirected to the homepage
    function bpfr_hide_admins_profile() {
    	global $bp; 
    	if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
    		wp_redirect( home_url() );
    	exit;
    	endif;
    }
    add_action( 'wp', 'bpfr_hide_admins_profile', 1 );
    

    2. – Remove admin from the member directory and recount members

    COPY CODE
    
    // Remove admin from the member directory
    function bpdev_exclude_users($qs=false,$object=false){
        
        $excluded_user='1'; // Id's to remove, separated by comma
    	
        if($object != 'members' && $object != 'friends')// hide admin to members & friends 
        return $qs;
    	
        $args=wp_parse_args($qs);
    
        if(!empty($args['user_id']))
        return $qs;	
    	
        if(!empty($args['exclude']))
    		$args['exclude'] = $args['exclude'].','.$excluded_user;
        else
    		$args['exclude'] = $excluded_user;
    	
        $qs = build_query($args);
    
        return $qs;
    	
    }
    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    
    // once admin is removed, we must recount the members !
    function bpfr_hide_get_total_filter($count){
        return $count-1;
    }
    add_filter('bp_get_total_member_count','bpfr_hide_get_total_filter');
    

    3. – Hide admin’s activities from all activity feeds

    COPY CODE
    
    // hide admin's activities from all activity feeds
    function bpfr_hide_admin_activity( $a, $activities ) {	
    	
    	// ... but allow admin to see his activities!
    	if ( is_site_admin() )	
    		return $activities;	
    	
    	foreach ( $activities->activities as $key => $activity ) {	
    		// ID's to exclude, separated by commas. ID 1 is always the superadmin
    		if ( $activity->user_id == 1  ) {			
    			
    			unset( $activities->activities[$key] );			
    			
    			$activities->activity_count = $activities->activity_count-1;			
    			$activities->total_activity_count = $activities->total_activity_count-1;			
    					$activities->pag_num = $activities->pag_num -1;				
    		}		
    	}		
    	// Renumber the array keys to account for missing items 	
    	$activities_new = array_values( $activities->activities );		
    	$activities->activities = $activities_new;	
    	
    	return $activities;
    	
    }
    add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
    

    For the premium accounts this would require some extra time and development, i suggest to hire a developer to do it for you 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #83195
     mtgame21
    Participant

    Thanks Laura, I will give this code a try. Also, I did some more research and found a plugin called BP Profile Visibility Manager that I will experiment with as well. You can mark this as resolved.

    #83279
     Laura
    Moderator

    Hello, will do 🙂 Let me know if you need anything

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #84753
     maxgalimberti
    Participant

    I tried the n. 2 but it doesn’t work, do I have to use the n. 2 alone

    #84985
     Laura
    Moderator

    Hello, try adding all of them 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #154391
     bonzothecat
    Participant

    Hi! Thanks for posting these theme updates. Unfortunately they don’t seem to work on my site – I updated the theme as per the instructions above, but “admin1234” (my admin account) still keeps showing up in all the member lists. Any ideas?

    Howard Taylor

    Sooke, BC, Canada

    #154492
     Laura
    Moderator

    Hello, did you add the user ID? its just a number, NOT the user name 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #154504
     bonzothecat
    Participant

    Hi, Laura! I rechecked the code that I entered (basically a cut-and-paste of yours), and confirmed it only references user id 1, and I also confirmed that the admin id on my system is 1. I have attached a copy of the my KLEO Child modifications, they look okay to me.

    Howard Taylor

    Sooke, BC, Canada

    #154512
     bonzothecat
    Participant

    Sorry, couldn’t upload the .TXT file:

    KLEO_child.txt: Sorry, this file type is not permitted for security reasons

    Howard Taylor

    Sooke, BC, Canada

    #154638
     Laura
    Moderator

    Hello, could you share admin credentials and ftp so i can take a look?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #154639
     bonzothecat
    Participant
    This reply has been set as private.
    #154765
     Laura
    Moderator

    Hello, i do not have access to any folder, please let me know 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #154774
     bonzothecat
    Participant
    This reply has been set as private.
    #154842
     Laura
    Moderator

    Hello, i mean to the ftp all i see is the ftp quota

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #154845
     bonzothecat
    Participant
    This reply has been set as private.
    #154848
     bonzothecat
    Participant
    This reply has been set as private.
    #154875
     Laura
    Moderator

    Hello, a suggestion: Create a new user, copy the user ID to the codes, make the user admin, delete the old admin user and assign all the stuff to the new admin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #154908
     bonzothecat
    Participant

    Hm. I have to wonder: if the code does not work for user id 1, why would it work for a different user id? Maybe I will just put up with admin always showing up in member lists.

    Thanks, Howard

    Howard Taylor

    Sooke, BC, Canada

    #155014
     Laura
    Moderator

    Hello, maybe the admin id is not 1,that is why i suggested to do that 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #155025
     bonzothecat
    Participant

    Hi, Laura;

    I’m pretty sure the admin id is 1: it shows up in the Edit Groups page.

    Cheers, Howard

    Howard Taylor

    Sooke, BC, Canada

    #155026
     bonzothecat
    Participant

    I checked the log, and I see this:

    [06-Mar-2017 12:19:59 UTC] PHP Fatal error: Cannot redeclare get_current_user_id() (previously declared in /home/htaylor/public_html/wp-includes/user.php:426) in /home/htaylor/public_html/wp-content/themes/kleo-child/functions.php on line 92

    Does this seem relevant?

    Cheers, Howard

    Howard Taylor

    Sooke, BC, Canada

    #155125
     Laura
    Moderator

    Hello, all i can suggest now is to hire a developer to look at it for you as the code doesnt seem to be working for an unknown reason

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #155126
     bonzothecat
    Participant

    Can you tell me if the version of VC supplied with Kleo, VC 4.10, is compatible with WP 4.7.3? Does VC 4.10 work on other Kleo sites? I see in the VC release notes that 4.11 was released to be compatible with WP 4.5, and the current VC release is 5.0.

    https://wpbakery.atlassian.net/wiki/display/VC/Release+Notes

    Howard Taylor

    Sooke, BC, Canada

    #155290
     Laura
    Moderator

    Hello, with each update, we update VC too, so just wait for the next kleo update 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

Viewing 25 posts - 1 through 25 (of 25 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?