function filter_blog_activity_by_category( $a, $activities ) {
global $bp;
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
if ( $activity->component == 'blogs' ) {
$blog_id = $activity->item_id;
$post_id = $activity->secondary_item_id;
switch_to_blog( $blog_id );
// Pull up the post using $post_id and get_post()
// Get the categories with get_the_category()
// If the post is in the excluded categories, then
unset( $activities->activities[$key] );
restore_current_blog();
}
}
/* 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', 'filter_blog_activity_by_category', 10, 2 );