I am using bbpress activity feeds in wp-multisite network

I am usign bbpress activity feeds in multisite network and wanted the feeds to appear on site itself and on parent site only, but not in whole network.

I applied this code to filter the activities

function bp_after_has_activities_parse_args_func($r)
{
$blog_id = get_current_blog_id();
global $wpdb;
$sql = $wpdb->prepare(“SELECT activity_id FROM ” . $wpdb->base_prefix . “bp_activity_meta WHERE meta_key=%s AND meta_value=%d”, ‘_source_blog’, $blog_id);

$ids = array_values($wpdb->get_col($sql));
if (empty($ids)) {
$r[‘in’] = ‘-1’;
} else {
$r[‘in’] = $ids;
}
return $r;
}

if (get_current_blog_id() !== 1) {
add_filter(‘bp_after_has_activities_parse_args’, ‘bp_after_has_activities_parse_args_func’);
}

But now, the blog posts are not appearing in the activity feed, but they must appear in activity feeds.
I need quick help and consulted lots of forums but no answer.
Need help with it.

Read more here:: I am using bbpress activity feeds in wp-multisite network

Leave a Reply

Your email address will not be published. Required fields are marked *