Skip to:

Re: Excluding blog post comments from activity stream page?



The achilles heel of @boonebgorges otherwise excellent approach is that you are essentially just removing items from the array, which causes activity stream atrophy. If you have a 20-item activity stream and 11 of those are blog comments, then you only have 9 items in the page before we get to “load more”, whereas you have a slow comment period, there may be 18 items on the page.

One a clean way to exclude blog post comments and/or forum replies from the main activity stream, but still preserve the activity stream length, would be by passing an additional WHERE != item to the database query. I couldn’t figure out a way to pass it, so as a proof-of-concept, I did this to exclude forum comments from the main page activity stream (on a BP install set up to display activity on the front page):

Go to Line 123 in bp-activity-classes.php:
$where_sql = 'WHERE ' . join( ' AND ', $where_conditions );

Add this line below it:
if ( $bp->current_component == "") { $where_sql .= " AND a.type != 'new_forum_post' "; }

This is just a proof-of-concept. I WOULD NOT take this approach for your site, because it will get overwritten when you upgrade your BP files.

Is anyone able to suggest a way to do this without messing with the BP core files?

Skip to toolbar