BuddyDev

Search

[Resolved] Hide activities of Admins & Editors in activitiy stream

  • Participant
    Level: Enlightened
    Posts: 72
    Vivek Mathur on #24977

    Hi Brajesh,

    I am trying to hide the activities of the admins and editor roles from the activity stream, so that other users (subscribers, authors) cannot see these in their stream (including group streams)

    I saw this snippet https://buddydev.com/hiding-users-on-buddypress-based-site/ , and your profile privacy plugin but those are for hiding members profiles, and not activities as i understand.

    Any suggestions how i can achieve this?

    thanks,
    Vivek

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2909
    Ravi on #24982

    Hello Vivek,

    Thank you for posting. Try the following code to remove activities of user from activity directory.

    
    add_filter( 'bp_after_has_activities_parse_args', function( $args ) {
    
    	if ( ! bp_is_activity_directory() ) {
    		return $args;
    	}
    
    	$args['filter_query'][] = array(
    		'column' => 'user_id',
    		'value' => '1,4',  // Replace by your user ids.
    		'compare' => 'NOT IN',
    	);
    
    	return $args;
    } );
    
    

    Please let me know if it works or not.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 72
    Vivek Mathur on #25017

    Thanks very much for this, Ravi – much appreciated.

    Will check this out and let you know.

    thanks, vivek

  • Participant
    Level: Enlightened
    Posts: 72
    Vivek Mathur on #25057
    This reply has been marked as private.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2909
    Ravi on #25059

    Hi Vivek,

    Yes, It will affect.

    Regards
    Ravi

The topic ‘ [Resolved] Hide activities of Admins & Editors in activitiy stream’ is closed to new replies.

This topic is: resolved