First Name (required)
[text* first-name]
Last Name (required)
[text* last-name]
Your Email (required)
[email* your-email]
Subject
[text your-subject]
Your Message
[textarea your-message]
Subscribe to our awesome newsletter?
[checkbox subscribe default:1 "Of course"]
[submit "Send"]
Groupings is used this way: Create a new Grouping in Mailchimp, named "Form Used", and create groups named the exact name of your CF7 forms. If no group exists for that form name, the subscribe will FAIL, FYI. If you don't want to use groupings, change: 'LNAME'=> $formdata['last-name'], 'GROUPINGS'=>array( array('name'=>'Form Used', 'groups'=>$formtitle), )); to 'LNAME'=> $formdata['last-name']); Simple enough. Change "Form Used" in the code if you want a different Groupings name, such as "Interested In", with each form named "Inquiry", "Quote", "Contest", etc, tracking the source in Mailchimp of each subscriber. If you prefer to have the subscriber verify their email first before adding, change: $retval = $api->listSubscribe($list_id, $send_this_email, $mergeVars, 'html', false); to: $retval = $api->listSubscribe($list_id, $send_this_email, $mergeVars, 'html', true); I may tackle adding variables for turning groupings and double opt-in on/off later, & turn this into a plugin. Enjoy! Hit me up at http://webwizards.net/ if you have any questions or comments. Rob Inspired by http://www.bigbossmas.com/wordpress/integrating-contact-form-7-to-mailchimp-the-better-way/ */ function wpcf7_send_to_mailchimp($cfdata) { $formtitle = $cfdata->title; $formdata = $cfdata->posted_data; if ( $formdata['subscribe'] ) { $send_this_email = $formdata['your-email']; $mergeVars = array( 'FNAME'=>$formdata['first-name'], 'LNAME'=> $formdata['last-name'], 'GROUPINGS'=>array( array('name'=>'Form Used', 'groups'=>$formtitle), )); // MCAPI.class.php needs to be in theme's root folder with functions.php require_once(TEMPLATEPATH . '/MCAPI.class.php'); // grab an API Key from http://admin.mailchimp.com/account/api/ $api = new MCAPI('--- YOUR API KEY HERE ---'); // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/ $list_id = "--- YOUR LIST ID HERE ---"; // Send the form content to MailChimp List without double opt-in $retval = $api->listSubscribe($list_id, $send_this_email, $mergeVars, 'html', false); } } add_action('wpcf7_mail_sent', 'wpcf7_send_to_mailchimp', 1); ?>