BuddyDev

Search

[Resolved] Hide Admin activity

  • Participant
    Level: Enlightened
    Posts: 34
    Gisela Zechner on #51358

    Hi BuddyDev-Team,

    an old question, I searched in the forum but did not find a solution.
    I have added the following Code (found in internet) in the functions.php and the Admin is not visible on the members site. But it is still visible in last acitivities.

    /**
    * Exclude Users from BuddyPress Members List by WordPress role.
    *
    * @param array $args args.
    *
    * @return array
    */
    function buddydev_exclude_users_by_role( $args ) {
    // do not exclude in admin.
    if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
    return $args;
    }
    
    $excluded = isset( $args['exclude'] ) ? $args['exclude'] : array();
    
    if ( ! is_array( $excluded ) ) {
    $excluded = explode( ',', $excluded );
    }
    
    $role = 'administrator';// change to the role to be excluded.
    $user_ids = get_users( array( 'role' => $role, 'fields' => 'ID' ) );
    
    $excluded = array_merge( $excluded, $user_ids );
    
    $args['exclude'] = $excluded;
    
    return $args;
    }
    
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users_by_role' );

    I have also disabled all visibility via Dashboard > … > extended profile > View – settings But the activities are still viewable by other users.

    Thanks in advance

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51366

    Hello Gisela,

    Please take a look at the following plugin:

    https://buddydev.com/plugins/bp-stealth-mode-for-site-admin/

    It allows site admins to act in hidden mode on the site.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 34
    Gisela Zechner on #51368

    Hello Ravi,

    thanks a lot for the hint – I’ve installed the plugin, it seems to work properly.

    Best wishes
    Gisela

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51376

    Hello Gisela,

    Thank you for the acknowledgement. I am glad that I could help.

    Regards
    Ravi

The topic ‘ [Resolved] Hide Admin activity’ is closed to new replies.

This topic is: resolved