Skip to content

Instantly share code, notes, and snippets.

@alex-authlab
Created April 23, 2021 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-authlab/4fb0962b3f70023c7ceea1dc6607d6d6 to your computer and use it in GitHub Desktop.
Save alex-authlab/4fb0962b3f70023c7ceea1dc6607d6d6 to your computer and use it in GitHub Desktop.
redirect by checking zip codes set
add_filter('fluentform_form_submission_confirmation', function($confirmation,$formData,$form){
$targer_form_id = 11;
if($form->id!= $targer_form_id) {
return ;
}
$set_1 = ['ABCD','AAAA'];
$set_2 = ['ABAB','BBBB'];
$url_1 = 'https://www.facebook.com/groups/fluentforms';
$url_2 = 'https://www.facebook.com';
$address_field_name = 'address_1';
$zip_code = $formData[$address_field_name]['zip'];
$final_url = ''; //set deafult url here if not macthed any set
if (in_array($zip_code, $set_1)) {
$final_url = $url_1;
}else if (in_array($zip_code, $set_2)){
$final_url = $url_2;
}
$data = [
'redirectUrl' => 'https://www.facebook.com',
'redirectTo'=> 'customUrl',
'messageToShow' => 'Thank you for your message',
'customPage'=>'',
'samePageFormBehavior'=>'reset_form',
'customUrl'=> $final_url
];
return $data;
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment