options['double_optin']; // find email field & checkbox value foreach( $form['fields'] as $field ) { if( $field->type === 'email' && empty( $email_address ) && ! empty( $submission[ $field->id ] ) ) { $email_address = $submission[ $field->id ]; } if( $field->type === 'mailchimp' && ! empty( $submission[ $field->id ] ) ) { $subscribe = true; $mailchimp_list_id = $field->mailchimp_list; if( isset( $field->mailchimp_double_optin ) ) { $double_optin = $field->mailchimp_double_optin; } } } if( ! $subscribe || empty( $email_address ) ) { return; } // override integration settings with field options $orig_options = $this->options; $this->options['lists'] = array( $mailchimp_list_id ); $this->options['double_optin'] = $double_optin; // perform the sign-up $this->subscribe( array( 'EMAIL' => $email_address ), $submission['form_id'] ); // revert back to original options in case request lives on $this->options = $orig_options; } public function editor_js() { ?> get_cached_lists(); ?>