Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding the admin user

Viewing 2 replies - 1 through 2 (of 2 total)

  • Venutius
    Moderator

    @venutius

    It’s doable to a certain extent, you’d need to overload the members loop and exclude admin from the loop, also overload the members profile template to redirect other members trying to view the admin user’s profile.

    Take a look at BP Template Overloader, it creates a list of the files you can overload, and it can set up the overload file automatically for you. It will allow you to view the source files direct and let you plan your modifications. That’s the first step.


    shanebp
    Moderator

    @shanebp

    You could use the overload method.
    imo, using hooks is easier.

    For example, to hide admin users from the members loop, you could put this into bp-custom.php… untested…

    function grw_members_loop_ghosts( $retval ) {
    
        if ( bp_is_members_directory() ) {
    
            $admins = get_users( array(
    				'fields' => 'ID',
    				'role'   => 'administrator',
    			      ));
            
            $admins = implode(',', $admins );
    
            $retval['exclude'] = $admins;
        }
    
        return $retval;
    }
    add_filter( 'bp_before_has_members_parse_args', 'grw_members_loop_ghosts' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar