Solution: credit to @lincme on the post https://buddypress.org/support/topic/filtering-out-activity-stream-stuff/
// Remove (hide) various activities from streams.
function my_hidden_activities($a, $activities) {
//if admin we want to know
//if (is_site_admin())
//return $activities;
$nothanks = array('activity_comment');
foreach ($activities->activities as $key => $activity) {
if (in_array($activity->type, $nothanks, true)) {
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_hidden_activities', 10, 2 );
The above code causes a problem w/ ajax commenting; the content doesn’t immediately display which is a bit troublesome. Any better solution?
I took a very hacky approach to the activity-loop.php
changed:
<?php bp_get_template_part( 'activity/entry' ); ?>
to:
<?php if(bp_get_activity_type() != "activity_comment"): ?>
<?php bp_get_template_part( 'activity/entry' ); ?>
<?php endif; ?>
This will almost guaranteed cause problems in the loop keeping track of how many activities there are to display.
@godavid33
10 years, 8 months ago
How can I prevent this? It is a bit redundant and clutter to show comments as single activity posts, when out of context they likely won’t mean anything.