Last active
March 29, 2016 23:32
-
-
Save cameck/63aebd2f10bfeb0f2c67 to your computer and use it in GitHub Desktop.
Cancel Constant Contact Subscription if User does not Check the sign up box on more than one form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function disable_newsletter_signup( $form_id ) { | |
global $ninja_forms_processing; | |
$form_id = $ninja_forms_processing->get_form_ID(); | |
if ( $form_id == 1 || $form_id == 2 || $form_id == 3 ) { | |
switch ($form_id) { | |
case 1: //Form 1 | |
$opt_in = $ninja_forms_processing->get_field_value( 32 ); | |
break; | |
case 2: //Form 2 | |
$opt_in = $ninja_forms_processing->get_field_value( 25 ); | |
break; | |
case 3: //Form 3 | |
$opt_in = $ninja_forms_processing->get_field_value( 14 ); | |
break; | |
default: | |
break; | |
} | |
if ( $opt_in == 'unchecked' ) { | |
$ninja_forms_processing->update_form_setting( 'constant_contact_signup_form', false ); | |
} | |
} | |
} | |
add_action( 'ninja_forms_pre_process', 'disable_newsletter_signup' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment