SHARE
TWEET

Conditionally modify autoresponder

chrishajer Sep 7th, 2011 245 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // http://www.gravityhelp.com/forums/topic/conditional-logic-for-user-notifications
  2. // update the "2" to the ID of your form
  3. add_filter('gform_pre_submission_filter_2', 'conditional_message');
  4. function conditional_message($form){
  5.  
  6.         // update the "7_1" following "input_" to the IDs of your fields
  7.         $choice1 = RGForms::post('input_7_1');
  8.         $choice2 = RGForms::post('input_7_2');
  9.         $choice3 = RGForms::post('input_7_3');
  10.  
  11.         // if any box was checked, say thank you.  Since field is required, this will always test TRUE
  12.         if($choice1 || $choice2 || $choice3)
  13.                 $form['autoResponder']['message'] .= "Thank You";
  14.  
  15.         // append a different PDF link based on the interest
  16.         if($choice1)
  17.                 $form['autoResponder']['message'] .= "<p><a href='http://kreatorsafety.com/uploads/belt_guard.pdf' title='Download your free Belt Guard Data Sheet'>BELT GUARD DATA SHEET DOWNLOAD</a></p>";
  18.         if($choice2)
  19.                 $form['autoResponder']['message'] .= "<p><a href='http://kreatorsafety.com/uploads/coupling.pdf' title='Download your free Safety Guard Data Sheet'>COUPLING GUARD DATA SHEET DOWNLOAD</a></p>";
  20.         if($choice3)
  21.                 $form['autoResponder']['message'] .= "<p><a href='http://kreatorsafety.com/uploads/K.S.Catalogue.pdf' title='Download your free Catalogue here'>SAFETY GUARD CATALOGUE DOWNLOAD</a></p>";
  22.  
  23.         // return modified form
  24.         return $form;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top