Skip to:

Hide Admin from Group List

  • Profile photo of xKroniK13x


    I am creating a social website for many colleges, and created a new group for all of the colleges (roughly 91 right now). Since I created the group, I was auto-assigned as the administrator of it. I don’t want my account accessible or visible to anyone, as I am not attending that college. I have used the script as follows to remove myself from the members list (a list of all members on the buddypress site, regardless of what group they are in):

    function bpdev_exclude_users($qs=false,$object=false){
     //list of users to exclude
     $excluded_user='1';//comma separated ids of users whom you want to exclude
     if($object!='members')//hide for members only
     return $qs;
     //check if we are listing friends?, do not exclude in this case
     return $qs;
     return $qs;

    This works great, it completely removes me from the loop, but if you click on a group page, my name will still appear in that loop. I am trying to make my account completely invisible, so this is only half way there.

    I used the following code to make my profile not viewable, but my name still appears, but when you click it you get 404. I want to keep this implemented for the future, so it’s like I don’t exist:

    add_action( 'wp', 'hide_profile_template', 1 );
    function hide_profile_template() {
    global $bp; 
        if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
            global $wp_query;

    I’ve been adding this code to a new plugin that I named simply “Hide Admin,” if that is relevant at all. I chose to do this opposed to using the functions.php file to simply make it easier to toggle, in case I ever decide to make myself visible in the future.

    I’ve done lots of Googling, and have also attempted to edit the groups-loop file to excluse user-id 1, but it either breaks it completely or simply does not work.

    I’m really at a loss here, I’d appreciate the help! Thanks!

Viewing 1 replies (of 1 total)
  • Profile photo of shanebp


    Re your rebuild of the ajax_querystring…
    It’s even better to remove yourself before that query is constructed.
    Take a look at this hook: bp_pre_user_query_construct

    Re remove group admin from loop…
    That’s a tough one.
    I recall not being able to do that or that the consequences were too ugly or some fail.
    This is kinda of clunky – but sometimes I create a dummy user for use in those situations.
    And make it clear in that profile that you aren’t a member of _____.
    It gives you a ‘mask’ to wear and makes it easier to compartmentalize friend requests, etc.

Viewing 1 replies (of 1 total)
  • The topic ‘Hide Admin from Group List’ is closed to new replies.