Hi All,
I’ve just tested this again about a dozen times and every time it works. I’m going to show all of my pieces and if you think you see something different about your set up then maybe that’s part of the issue. I can’t spend more time troubleshooting this.
(Please excuse any random/testing text from my local/test environments.)
1. CF7 Form – Front End – https://imgur.com/a/pnZPAza
2. CF7 Form – Back End – https://imgur.com/a/tKy0LZS
3. Easy Forms Integration Checkbox Settings – https://imgur.com/a/F0iNKXq
4. MailChimp List Fields – https://imgur.com/a/CXcm3L5
5. Custom PHP Code (the first function logs extra details, the second function includes the first and last name of the subscriber with the MailChimp request).
/** Log all integration request bodies **/
add_filter( 'yikes-mailchimp-checkbox-integration-body', 'yikes_mailchimp_filter_checkbox_request_body', 10, 3 );
function yikes_mailchimp_filter_checkbox_request_body( $request_body, $integration_type, $list_id ) {
$request_body_string = print_r( $request_body, true );
$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
$error_logging->maybe_write_to_log(
$request_body_string,
__( "Testing Checkbox Integration", 'yikes-inc-easy-mailchimp-extender' ),
__( "Testing Checkbox Integration", 'yikes-inc-easy-mailchimp-extender' )
);
return $request_body;
}
/*
* Populate the 'Name' field in the MailChimp Mailing list from the 'your-name' field in Contact Form 7
*
* @since 6.0.2.1
*
* @param array | $merge_variables | An array of variables we're sending to MailChimp
* @param array | $cf7_variables | An array of variables we received from the CF7 form submission
* @return array| $merge_variables | An array of variables we're sending to MailChimp, hopefully with CF7 variables added
*/
function additional_contact_form_7_data( $merge_variables, $cf7_variables ) {
// Check our $cf7_variables array for 'your-firstname'
if ( isset( $cf7_variables['your-firstname'] ) ) {
// Filter first name and add it to our MailChimp merge variables array
$merge_variables['FNAME'] = filter_var( $cf7_variables['your-firstname'], FILTER_SANITIZE_STRING );
}
// Check our $cf7_variables array for 'your-lastname'
if ( isset( $cf7_variables['your-lastname'] ) ) {
// Filter last name and add it to our MailChimp merge variables array
$merge_variables['LNAME'] = filter_var( $cf7_variables['your-lastname'], FILTER_SANITIZE_STRING );
}
return $merge_variables;
}
Cheers,
Kevin.