Created
March 12, 2013 11:43
-
-
Save tiborp/5142275 to your computer and use it in GitHub Desktop.
Condtional auto-reply message for GravityForms
This file contains 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
<?php | |
// http://www.gravityhelp.com/forums/topic/conditional-logic-for-user-notifications | |
// update the "2" to the ID of your form | |
add_filter('gform_pre_submission_filter_2', 'your_prefix_conditional_message'); | |
function your_prefix_conditional_message($form){ | |
// update the "7_1" following "input_" to the IDs of your fields | |
$choice1 = RGForms::post('input_7_1'); | |
$choice2 = RGForms::post('input_7_2'); | |
$choice3 = RGForms::post('input_7_3'); | |
// if any box was checked, say thank you. Since field is required, this will always test TRUE | |
if($choice1 || $choice2 || $choice3) | |
$form['autoResponder']['message'] .= "Thank You"; | |
// append a different message (or link) based on the interest | |
if($choice1) | |
$form['autoResponder']['message'] .= "<p><a href='http://yourdownloadurl.com/uploads/choice1.pdf' title='Download your Choice1 here'>Choice1 Link Text</a></p>"; | |
if($choice2) | |
$form['autoResponder']['message'] .= "<p><a href='http://yourdownloadurl.com/uploads/choice2.pdf' title='Download your Choice2 here'>Choice2 Link Text</a></p>"; | |
if($choice3) | |
$form['autoResponder']['message'] .= "<p><a href='http://yourdownloadurl.com/uploads/choice3.pdf' title='Download your Choice3 here'>Choice3 Link Text</a></p>"; | |
// return modified form | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment