SHARE
TWEET

GF Email Notification #2

tylertervooren Dec 1st, 2011 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //EMAIL NOTIFICATION FUNCTION
  2. add_filter('gform_pre_submission_2', 'conditional_message');
  3. function conditional_message($form) {
  4.  
  5.  
  6. //Scoring logic for section scores to be individually placed in email.
  7.  
  8. $score_overall = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  9.  
  10.         if($lead[122] > -30)
  11.                 $score_overall = 'This is conditional answer #2.';
  12.         if($lead[122] > 0)
  13.                 $score_overall = 'This is conditional answer #3.';
  14.         if($lead[122] > 30)
  15.                 $score_overall = 'This is conditional answer #4.';
  16.  
  17. $score_career = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  18.  
  19.         if($lead[112] > -3)
  20.                 $score_career = 'This is conditional answer #2.';
  21.         if($lead[112] > 0)
  22.                 $score_career = 'This is conditional answer #3.';
  23.         if($lead[112] > 3)
  24.                 $score_career = 'This is conditional answer #4.';
  25.  
  26. $score_work = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  27.  
  28.         if($lead[113] > -3)
  29.                 $score_work = 'This is conditional answer #2.';
  30.         if($lead[113] > 0)
  31.                 $score_work = 'This is conditional answer #3.';
  32.         if($lead[113] > 3)
  33.                 $score_work = 'This is conditional answer #4.';
  34.  
  35. $score_investment = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  36.  
  37.         if($lead[114] > -3)
  38.                 $score_investment = 'This is conditional answer #2.';
  39.         if($lead[114] > 0)
  40.                 $score_investment = 'This is conditional answer #3.';
  41.         if($lead[114] > 3)
  42.                 $score_investment = 'This is conditional answer #4.';
  43.  
  44. $score_money = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  45.  
  46.         if($lead[115] > -3)
  47.                 $score_money = 'This is conditional answer #2.';
  48.         if($lead[115] > 0)
  49.                 $score_money = 'This is conditional answer #3.';
  50.         if($lead[115] > 3)
  51.                 $score_money = 'This is conditional answer #4.';
  52.  
  53. $score_outgoingness = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  54.  
  55.         if($lead[116] > -3)
  56.                 $score_outgoingness = 'This is conditional answer #2.';
  57.         if($lead[116] > 0)
  58.                 $score_outgoingness = 'This is conditional answer #3.';
  59.         if($lead[116] > 3)
  60.                 $score_outgoingness = 'This is conditional answer #4.';
  61.  
  62. $score_conflict = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  63.  
  64.         if($lead[117] > -3)
  65.                 $score_conflict = 'This is conditional answer #2.';
  66.         if($lead[117] > 0)
  67.                 $score_conflict = 'This is conditional answer #3.';
  68.         if($lead[117] > 3)
  69.                 $score_conflict = 'This is conditional answer #4.';
  70.  
  71. $score_relationship_building = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  72.  
  73.         if($lead[118] > -3)
  74.                 $score_relationship_building = 'This is conditional answer #2.';
  75.         if($lead[118] > 0)
  76.                 $score_relationship_building = 'This is conditional answer #3.';
  77.         if($lead[118] > 3)
  78.                 $score_relationship_building = 'This is conditional answer #4.';
  79.  
  80. $score_risk_strategy = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  81.  
  82.         if($lead[119] > -3)
  83.                 $score_risk_strategy = 'This is conditional answer #2.';
  84.         if($lead[119] > 0)
  85.                 $score_risk_strategy = 'This is conditional answer #3.';
  86.         if($lead[119] > 3)
  87.                 $score_risk_strategy = 'This is conditional answer #4.';
  88.  
  89. $score_adventure = 'Your answers made absolutely no sense at all. I award you no points and may God have mercy on your soul.';
  90.  
  91.         if($lead[120] > -3)
  92.                 $score_adventure = 'This is conditional answer #2.';
  93.         if($lead[120] > 0)
  94.                 $score_adventure = 'This is conditional answer #3.';
  95.         if($lead[120] > 3)
  96.                 $score_adventure = 'This is conditional answer #4.';
  97.  
  98.  
  99.         //This is where the message output will go. Does it replace the notification email set in GF or does it add to it?
  100.         $form['autoResponder']['message'] .= '$score_overall . " " . $score_career . " " . $score_work . " " . $score_investment . " " . $score_money . " " . $score_outgoingness . " " $score_conflict . " " . $score_relationship_building . " " . $score_risk_strategy . " " . $score_adventure';
  101.  
  102.         return $form;
  103. }
  104.  
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