Reply To: How can I exclude topics and replies from specific forums on the activity feed
This is not easy.
You need to use $activity_object->secondary_item_id to get the topic id.
Then use that to get the forum id.
Something like this, untested:
function imath_activity_dont_save( $activity_object ) {
global $wpdb;
$exclude = array( 'bbp_topic_create', 'bbp_reply_create');
$exclude_forum_ids = array( 1, 23, 44 ); // the ids of the specific forums to exclude
if( in_array( $activity_object->type, $exclude ) ) {
$topic_id = $activity_object->secondary_item_id;
$forum_id = $wpdb->get_var("SELECT post_parent FROM {$wpdb->prefix}posts WHERE ID = $topic_id");
if( in_array( $forum_id, $exclude_forum_ids ) )
$activity_object->type = false;
}
}
add_action('bp_activity_before_save', 'imath_activity_dont_save', 10, 1 );