Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://www.gravityhelp.com/forums/topic/making-a-result-page-based-on-conditional-logic
- // change the 15 below to your form ID
- add_filter('gform_confirmation_15', 'ch_build_confirmation', 10, 4);
- function ch_build_confirmation ($confirmation, $form, $lead, $ajax) {
- // initialize the confirmation message
- $confirmation = "<div id='gforms_confirmation_message' style='text-align:left; padding: 10px;'><p>Thank you for your
- candid answers. Here's what we think after reviewing your entries.</p>";
- // $lead[1] is the color choice question. I used values of "c, m, y, k, r, g, b"
- $confirmation .= '<p>What your <strong>color choice</strong> says about you: ';
- $rgb = array('r', 'g', 'b');
- $cmyk = array('c', 'm', 'y', 'k');
- if(in_array($lead[1], $rgb))
- $confirmation .= "you're a Photoshop person, comfortable in the digital world of RGB.</p>";
- else if(in_array($lead[1], $cmyk))
- $confirmation .= "you're a print person, happy around paper and ink.</p>";
- else
- // this will catch errors if an entered value was not accounted for in our arrays
- $confirmation .= "doesn't say much about you at all.</p>";
- // $lead[2] is the "appreciation vs accomplish" question
- $confirmation .= '<p><strong>What motivates you?</strong> ';
- if($lead[2] == 'Being appreciated')
- $confirmation .= "Being appreciated? That's sad and pathetic.</p>";
- else if($lead[2] == 'Getting results')
- $confirmation .= "That's more like it sparky. We're looking for results on this team.</p>";
- else
- // account for values not being entered somehow
- $confirmation .= "You're not really motivated are you? We've seen your type before.</p>";
- // $lead[3] is the "experience vs. gut" question
- $confirmation .= '<p>What do you <strong>trust</strong>? ';
- if($lead[3] == 'Actual experience')
- $confirmation .= 'Experience. We like that.</p>';
- else if($lead[3] == 'Gut instinct')
- $confirmation .= 'Your gut? Seriously?</p>';
- else
- $confirmation .= "You don't trust much do you?</p>";
- // close the confirmation message
- $confirmation .= "</div>";
- return $confirmation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement