Skip to:

Hide Admin from Members and Activity

  • Profile photo of Andrea Reed
    Andrea Reed


    Essentially I would like to hide the Admin profile from everyone logged into the site. So it does not show the profile, previous activity, or in any widgets. I have looked extensively and while there are many posts over the years, none of the solutions seem to work with the current version of BuddyPress (2.0.2).

    Has anyone found a successful solution?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Profile photo of danbp


    hi @canadadre,

    already asked and answered many times.

    And the most recent answer with a partial solution is here:

    Partial means you have to complete the work, by using the same method, as the given example concern only one core widget, and not the 2 other (the 4th is the registration widget).

    i know some guys do not like codecanyon and the likes, but here is a guess on what you did not search yet:

    Profile photo of Andrea Reed
    Andrea Reed


    @danbp I look through your links but don’t see the answer to what I’m looking for. I basically want to hide the Administrator’s profile completely from the front end of the site.

    Profile photo of danbp


    hi @canadadre,

    you have to read the mentionnedd topic AND to follow the links if the topic contains some. 😉

    i hope for you that you know how to copy/paste, because the above snippets must be added to your child-theme functions.php, or better into bp-custom.php

    1. – Deny access to admins profile

    // 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() );
    add_action( 'wp', 'bpfr_hide_admins_profile', 1 );

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

    // 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;
        return $qs;	
    		$args['exclude'] = $args['exclude'].','.$excluded_user;
    		$args['exclude'] = $excluded_user;
        $qs = build_query($args);
        return $qs;
    // once admin is removed, we must recount the members !
    function bpfr_hide_get_total_filter($count){
        return $count-1;

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

    // 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 );

    May this help !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide Admin from Members and Activity’ is closed to new replies.
Skip to toolbar