$field ) { if( $field['type'] === 'mailchimp' && $field['value_raw'] == 1 ) { return $this->subscribe_from_wpforms( $field_id, $fields, $form_data ); } } } public function subscribe_from_wpforms( $checkbox_field_id, $fields, $form_data ) { foreach( $fields as $field ) { if( $field['type'] === 'email' ) { $email_address = $field['value']; } } $mailchimp_list_id = $form_data['fields'][$checkbox_field_id]['mailchimp_list']; $this->options['lists'] = array( $mailchimp_list_id ); if( ! empty( $email_address ) ) { return $this->subscribe( array( 'EMAIL' => $email_address ), $form_data['id'] ); } } /** * @param int $form_id * @return string */ public function get_object_link( $form_id ) { return 'WPForms'; } }