Description #
This filter is available just before sending the success message to the user. You can use this filter hook to alter the form confirmation message and redirect settings dynamically.
apply_filters('fluentform/submission_confirmation', $returnData, $form, $confirmation );
Usage #
The following would apply to all forms:
add_filter('fluentform/submission_confirmation', 'custom_code_before_confirmation_msg_function', 10, 3);
function custom_code_before_confirmation_msg_function($returnData, $form, $confirmation )
{
// Do your stuffs here
return $returnData;
}
The following would apply to a specific form id 5:
add_filter('fluentform/submission_confirmation', 'custom_code_before_confirmation_msg_function', 10, 3);
function custom_code_before_confirmation_msg_function($returnData, $form, $confirmation )
{
if($form->id!= 5) {
return $returnData;
}
// Do your stuffs here
return $returnData;
}
Parameters #
- $returnData (array)
This parameter will have different values based on your confirmation settings, please check the file FluentForm\App\Http\Controllers\SubmissionHandlerController for better understanding.
$returnData = [
'message' => 'Redirecting message'
'action' => 'hide_form'
'redirectTo' => customUrl
'redirectUrl' => http://google.com
];
- $form (Object) The $form Object
- $confirmation (array)
$confirmation = [
'redirectTo' => 'samePage' // or customUrl or customPage
'messageToShow' => 'Thank you for your message. We will get in touch with you shortly'
'customPage' => ''
'samePageFormBehavior' => 'hide_form' // or reset_form
'customUrl' => 'https://yourcustomurl.com'
];
Placement #
This code should be placed in the functions.php file of your active theme.
Source Code #
This filter is located in FluentForm\app\Services\Form\SubmissionHandlerService -> getReturnData($insertId, $form, $formData)