View Categories

fluentform/submission_confirmation

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, $insertId, $formData);

Usage   #

The following would apply to all forms:

add_filter('fluentform/submission_confirmation', 'custom_code_before_confirmation_msg_function', 10, 5);

function custom_code_before_confirmation_msg_function($returnData, $form, $confirmation, $insertId, $formData)
{
   // 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, 5);

function custom_code_before_confirmation_msg_function($returnData, $form, $confirmation, $insertId, $formData)
{
   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

];
$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'
];
  • $insertId (int) Submission ID
  • $formData (array) Submission Data

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)