This snippet for the Gravity Forms add-on prevents the form notification settings on the child forms from being modified during broadcasting.
/**
@brief Save the current form meta.
@since 2019-09-27 04:52:05
**/
function bc_broadcast_gf_child_form_located( $action )
{
global $bc_gravity_form_meta;
global $wpdb;
if ( ! is_array( $bc_gravity_form_meta ) )
$bc_gravity_form_meta = [];
$bgf = broadcast_gravity_forms();
// Save the current form meta.
$table = $bgf->rg_gf_table( 'form_meta' );
$query = sprintf( "SELECT * FROM `%s` WHERE `form_id` = '%s'", $table, $action->form_id );
$bc_gravity_form_meta[ $action->form_id ] = $wpdb->get_row( $query );
}
add_action( 'broadcast_gf_child_form_located', 'bc_broadcast_gf_child_form_located' );
/**
@brief Replace the "new" form meta with old data.
@since 2019-09-27 04:52:13
**/
function bc_broadcast_gf_modify_form_meta( $action )
{
global $bc_gravity_form_meta;
// Restore the "current" notifications;
$action->meta->notifications = $bc_gravity_form_meta[ $action->form_id ]->notifications;
}
add_action( 'broadcast_gf_modify_form_meta', 'bc_broadcast_gf_modify_form_meta' );