Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to integrate a check box, so that the user can opt-in to my MailChimp newsletter, into the Contact Form 7.

I used this tutorial : http://www.silenceit.ca/2011/02/28/how-to-integrate-mailchimp-with-contact-form-7

Everything works (sends the data to the email address, and also sends data to mailchimp) But the confirmation dialog never shows up. Only a red box. The function works perfectly though. I think it is because contact form 7 was updated since that blog post.

If anyone can help. PLEASE Let me know.

My URL: http://s137929.gridserver.com/contact/

share|improve this question
    
I was able to figure this out. The tutorial above is for an older version of Contact From 7. I guess since the update, it causes errors with MailChimp integration. If anyone is looking to do this, I would suggest using v2.4.1 - If I figure out how to use MailChimp with the latest version, I will post here. Thanks. –  avexdesigns Dec 28 '11 at 17:32
add comment

3 Answers

Thanks to the answer from John at avexdesign above as well as the link to the tutorial from SilenceIT, I have a couple more details in case anyone comes across this.

As of version 3.1, the line to edit is now line 60 in the controller.php file. As stated by avexdesigns, you must change ONLY the variables '$items' that were added via the original tutorial to '$result'. There are many other $items in the file so make sure you do NOT find and replace all.

Also, per the SilenceIT tutorial, the if statement where you put all of this code in originally was:

} elseif ( $wpcf7_contact_form->mail() ) {

it is now:

if ( $result['mail_sent'] ){

Hope that helps!

share|improve this answer
add comment

If someone comes across this post, I came up with a better solution that uses contact form 7 action hook to trigger subscription API. You just need to add a MCAPI.class.php file to your theme folder and add a code to your function.php file. Detailed instruction is in my blog post:

http://www.bigbossmas.com/wordpress/integrating-contact-form-7-to-mailchimp-the-better-way/

I am not using a check box in the contact form for a user to opt-in, but you can easily add it to the code with some straightforward conditional statements.

share|improve this answer
add comment

Ok, so I was able to change this code to work with the new version of Contact Form 7. After following instructions on the tutorial above, you will need to change $items to $result

(older contact for 7 used $items, the newer versions use $result, therefore this needs to be updated as well)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.