Toolset: Broadcast form entry back to the parent

This snippet for Broadcast shows how to hook into the post editing form of Toolset, to broadcast the post back to where it was originally broadcasted from.

add_action( 'cred_save_data', 'bc_cred_save_data', 10, 2 );
function bc_cred_save_data($post_id, $form_data)
{
	// We are only listening for form #4
	if ( $form_data['id'] != 4 )
		return;
	
	// Broadcast must be active.
	if ( ! function_exists( 'broadcast_back_to_parent' ) )
		return;
	 
	// We must be on a specific blog.
	if ( get_current_blog_id() != 7 )
		return;
	 
	ThreeWP_Broadcast()->debug( 'Sending CRED form post back to parent: %s', $post_id );
	broadcast_back_to_parent()->back_to_parent( $post_id );
}