Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // http://www.gravityhelp.com/forums/topic/checkbox-on-form-for-confirmation-email#post-116946
- // change the 243 here to your form ID
- add_action('gform_pre_submission_filter_243', 'notification_preference');
- function notification_preference($form) {
- // this will enable a checkbox to confirm receipt of the autoresponder which is
- // already configured. If it is not set, then clear the autoresponder array
- // input_4_1 is my checkbox, and I have enabled values and set the value to 'yes' if it is checked
- // change the input_4_1 to your field ID, and the 'yes' to whatever value you have set when this is checked/selected
- if (defined(rgpost('input_4_1')) && (rgpost('input_4_1') == 'yes')) {
- return $form;
- }
- else {
- // clear out any autoresponder values
- $form['autoResponder'] = array(
- 'toField' => '',
- 'bcc' => '',
- 'fromName' => '',
- 'from' => '',
- 'replyTo' => '',
- 'subject' => '',
- 'message' => '',
- 'disableAutoformat' => '');
- return $form;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement