Skip to:
Content
Pages
Categories
Search
Top
Bottom

Excluding roles from activity feeds


  • ariktwena
    Participant

    @ariktwena

    Hi

    I really need some help here. I have different user-roles on my website, but I want to exclude a specific user-role from showing up on the overall activity page/feed.

    I forund this code where the admin is excluded:

    
    // hide admin's activities from all activity feeds
    function bpfr_hide_admin_activity( $a, $activities ) {
    
    	// ... but allow admin to see his activities!
    	if ( is_site_admin() )
    	return $activities;
    
    	foreach ( $activities->activities as $key => $activity ) {
    		// ID's to exclude, separated by commas. ID 1 is always the superadmin
    		if ( $activity->user_id == 784  ) {			
    
    			unset( $activities->activities[$key] );
    
    			$activities->activity_count = $activities->activity_count-1;
    			$activities->total_activity_count = $activities->total_activity_count-1;
    			$activities->pag_num = $activities->pag_num -1;
    		}
    	}
    	// Renumber the array keys to account for missing items
    	$activities_new = array_values( $activities->activities );
    	$activities->activities = $activities_new;
    
    	return $activities;
    
    }
    add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
    

    So i’m hoping someone can help me adjust it. I need for the users that have the user-role ‘Banditter’ && ‘Participant’ not to show up on the overall activity feed, but for them to see their own activity. Plus for the Admin to see all activity

    I don’t know so much PHP, so i’m hoping for some help 🙂

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar