Advertisement
chrishajer

Offer a checkbox to get a copy of autoResponder or not

Jan 8th, 2013
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/checkbox-on-form-for-confirmation-email#post-116946
  3. // change the 243 here to your form ID
  4. add_action('gform_pre_submission_filter_243', 'notification_preference');
  5. function notification_preference($form) {
  6.     // this will enable a checkbox to confirm receipt of the autoresponder which is
  7.     // already configured.  If it is not set, then clear the autoresponder array
  8.     // input_4_1 is my checkbox, and I have enabled values and set the value to 'yes' if it is checked
  9.     // change the input_4_1 to your field ID, and the 'yes' to whatever value you have set when this is checked/selected
  10.     if (defined(rgpost('input_4_1')) && (rgpost('input_4_1') == 'yes')) {
  11.         return $form;
  12.     }
  13.     else {
  14.         // clear out any autoresponder values
  15.         $form['autoResponder'] = array(
  16.             'toField' => '',
  17.             'bcc' => '',
  18.             'fromName' => '',
  19.             'from' => '',
  20.             'replyTo' => '',
  21.             'subject' => '',
  22.             'message' => '',
  23.             'disableAutoformat' => '');
  24.         return $form;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement