bookmark_bordergform_pre_confirmation_save

Description

Modify the confirmation object before it is saved to the database. This is particularly useful when saving custom confirmation settings to the confirmation object.

Usage

Apply to all forms:

add_filter( 'gform_pre_confirmation_save', 'my_custom_function', 10, 2 );

Apply to a specific form ID:

add_filter( 'gform_pre_confirmation_save_5', 'my_custom_function', 10, 2 );

Parameters

  • $confirmation Confirmation Object

    The confirmation object about to be saved.

  • $form

    The current form object to which the confirmation being saved belongs.

Examples

This example demonstrates how you can add the value entered via our gform_confirmation_ui_settings to the confirmation object before it is saved to the database. Use with the gform_confirmation_ui_settings hook to display your custom settings UI.

If your UI settings have a “name” attribute, they will be submitted along with the rest of the default confirmation settings. We can then retrieve our custom value from the $_POST using the Gravity Forms helper function rgpost().

add_filter( 'gform_pre_confirmation_save', 'my_custom_confirmation_save', 10, 2 );
function my_custom_confirmation_save( $confirmation, $form ) {
    $confirmation['my_custom_setting'] = rgpost( 'my_custom_setting' );
    return $confirmation;
}

Source Code

This filter is located in GFFormSettings::handle_confirmation_edit_submission() in form_settings.php