Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: exclude admin in activitystream

something like this may work – just enter in the user_id of the admin account and the activity items are removed from the activity array.

function my_denied_admin_activity( $a, $activities ) {

//if admin we want to know
if ( is_site_admin() )
return $activities;

foreach ( $activities->activities as $key => $activity ) {
if ( $activity->user_id == 1 ) {

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', 'my_denied_admin_activity', 10, 2 );

Skip to toolbar