BBPress: Automatically broadcast new topics

This snippet will automatically broadcast new topics to other blogs.

/**
    @brief        Broadcast a newly-created topic to other blogs.
    @since        2019-09-12 19:03:05
**/
function bc_bbp_new_topic( $topic_id )
{
    // These are the blogs from which we want to broadcast new topics.
    $blogs_to_broadcast_from = [ 1, 2, 3, 4 ];
    // These are the blogs from which we want to broadcast new topics.
    $blogs_to_broadcast_to = [ 10, 11, 12 ];

    if ( ! in_array( get_current_blog_id(), $blogs_to_broadcast_from ) )
        return;

    ThreeWP_Broadcast()->api()->broadcast_children( $topic_id, $blogs_to_broadcast_to );
}
add_action( 'bbp_new_topic', 'bc_bbp_new_topic' );