Just found a near-hit for my needs in this post by @modemlooper:
https://buddypress.org/support/topic/disable-group-posts-from-main-activity-stream/
However, the code below is stripping group posts from both the “Activities” page and a member’s page activity. I tried to limit to user pages only by altering if ( bp_is_current_component( ‘activity’ ) to if ( bp_is_current_component( ‘profile’ ) but didn’t work. Anyone see what I need to change so that this snippet only fires if it is on a member’s activity page?
function bp_filter_groups_from_activity( $a, $activities ) {
if ( bp_is_current_component( 'activity' ) ) {
foreach ( $activities->activities as $key => $activity ) {
if ( $activity->component =='groups') {
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;
}
}
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
}
return $activities;
}
add_action('bp_has_activities','bp_filter_groups_from_activity', 10, 2 );
Try :
if ( bp_is_current_component( 'activity' ) && bp_is_user() ) {
Have to do a little more testing but this looks like it did the trick! Thanks for the quick reply. 🙂