Created
April 23, 2021 10:43
-
-
Save alex-authlab/4fb0962b3f70023c7ceea1dc6607d6d6 to your computer and use it in GitHub Desktop.
redirect by checking zip codes set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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