Reply To: Inserting activity content via plugin
Try adding this to your theme’s functions.php file:
function valuser_add_new_post_activity( $ID, $post ) {
$user = get_userdata( $post->post_author );
$args = array(
'user_id' => $post->post_author,
'action' => $user->user_login . ' published ' . $post->post_title,
'component' => buddypress()->blogs->id,
'type' => 'new_blog_post',
'item_id' => get_current_blog_id(),
'secondary_item_id' => $post->ID,
'recorded_time' => bp_core_current_time(),
'hide_sitewide' => false
);
bp_activity_add( $args );
}
add_action( 'publish_post', 'valuser_add_new_post_activity', 10, 2 );
That’s how I’d add new blog posts to the activity stream. I’ve hooked bp_activity_add() to the published_post action which will fire each time a new post is added to the database.
Please note I haven’t tested.