Hide Admin User

This topic contains 5 replies, has 2 voices, and was last updated by  themosaurus 2 days, 15 hours ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4106

    Werner
    Participant
    • 7 Posts
    @creation

    Hi there,

    I do not want to show up as a registered user in the Members-List.
    How can I avoid that (make myself invisible)?

    Thanks for your help.

    #4108

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    Hi @creation,

    There is no option in BuddyPress to hide admin users, but you can resolve this issue by using the following plugin that was kindly shared by a member of our community @abourne 🙂

    BP Custom Functionalities

    That plugin has an option to hide members from the member directory by their role, which means you can use it to hide all admin users from the directory.

    Hope this helps you resolve your issue.

    Regards

    #4109

    Werner
    Participant
    • 7 Posts
    @creation
    This reply has been marked as private.
    #4114

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    Ok, it looks like this plugin unfortunately has some issue, so we advise that you uninstall it.

    Could you try using the following PHP code snippet instead:

    // Remove admin from the member directory
    function gwangi_hide_admins( $qs = false, $object = false ) {
    
    	$excluded_user = implode( ',', get_users( 'role=administrator&fields=ID' ) );
    
    	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', 'gwangi_hide_admins', 20, 2 );

    To find out how to add a PHP code snippet to your website, we advise that you take a look at this article of our documentation:

    Adding Custom PHP Without Changing Your Child Theme

    Regards

    #4115

    Werner
    Participant
    • 7 Posts
    @creation

    It worked!
    Thanks a lot!!!!

    #4120

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    You’re welcome. 🙂

    Best regards,

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

The topic ‘Hide Admin User’ is closed to new replies.