How to hide admin account in BuddyPress? (for security reasons)

I found this:

Exclude Users from Members directory on a BuddyPress based social network

We will need to hook to 'bp_ajax_querystring' filter.

The following code will allow to exclude the users from the members directory. They will be still listed in the friends list of other users with whom they are friends with.

add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
function bpdev_exclude_users($qs=false,$object=false){
 //list of users to exclude

 $excluded_user="1,2,3";//comma separated ids of users whom you want to exclude

 if($object!='members')//hide for members only
 return $qs;

 $args=wp_parse_args($qs);

 //check if we are listing friends?, do not exclude in this case
 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;

}

Source

And in BP foruns:

how to hide admin activity on Buddypress activity?

Put this code in bp-custom.php and None of the site admin activity will be recorded nor will you appear in the Who is Online/ recently active members widget.

add_action("plugins_loaded","bpdev_init_sm_mode");
function bpdev_init_sm_mode(){
if(is_site_admin())
remove_action("wp_head","bp_core_record_activity"); //id SM is on, remove the record activity hook
}

Source

I think you can merge both filters and hide Admin Once and for all 🙂

UPDATE

Because these hacks aren’t working in 1.6 this topic suggest it may work by using the old admin bar in BuddyPress. Is that so?

Leave a Comment

error code: 523