add_filter('frm_redirect_url', 'return_page', 9, 3);With the code above, if the email contains @yahoo or @google or @facebook, you will be redirected to faang.com. If the email contains @amazon or @ebay or @next, you will be redirected to google.com. Ideally, need to adjust to function like the "if like" "if not like" conditionals - i.e.
function return_page($url, $form, $params){
if($form->id == 664){ //change 5 to the ID of the form to redirect
$field_id = 15678; //change 25 the the ID of your field
$postedvalue = $_POST['item_meta'][$field_id]; //We are storing the value submitted in the field in the variable $postedvalue. And we will create our logic using that variable.
if(strpos($postedvalue, '@yahoo') !== false || strpos($postedvalue, '@google') !== false || strpos($postedvalue, '@facebook') !== false ) //If the value submitted contains @yahoo (You can modify that your preferred string)
{
$url = 'https://faang.com';
}
else if(strpos($postedvalue, '@amazon') !== false || strpos($postedvalue, '@ebay') !== false || strpos($postedvalue, '@next') !== false)
{
$url = 'https://google.com';
}
}
return $url;
}
Can this be used with multiple email addresses/domains? I tried [if 45 like="@domain.com; [email protected]"] and [if 45 like="@domain.com, [email protected]"] and it redirects to error page.
We usually have a few domains and at least 1 individual email address we need to whitelist - otherwise the "else" would be perfect. 🙁
Please login or Register to submit your answer