Hi,
Using Mailchimp.
I would like to create a form in mailchimp and embed it in my site.
This is the basic layout: http://womenofthewall.us1.list-manage.com/subscribe?u=1998ef3f0f337064ca67a8d7e&id=d944ed6130
1. I would like to embed this form inside a specific page in the site.
2. This form needs to be sent to 5 different mails in addition.
3. I would like to add an additional checkbox (yes/no) for subscribing to the newsletter list as well. (different list).
ALSO, create a thank you page.
:-)
Thanks,
Sharon
Arnav Joy answers:
if you have mailchimp then please have a look in following url
http://www.bigbossmas.com/wordpress/integrating-contact-form-7-to-mailchimp-the-better-way/
Arnav Joy comments:
try this to get emails...
<?php
add_action( 'wpcf7_before_send_mail', 'get_cf7_email' );
function get_cf7_email( $cf7 )
{
$email = $cf7->posted_data["your-email"]; // where your-email is the name of the field of email
// do whatever you want to do with email field like store in db or print it.
echo $email;
}
?>
cloudnclear comments:
Hello,
I'm trying to follow the instructions in the link you've sent me:
http://www.bigbossmas.com/wordpress/integrating-contact-form-7-to-mailchimp-the-better-way/
But i cannot find the "MCAPI.class.php" file to upload into my theme folder
Arnav Joy comments:
go to this path
http://apidocs.mailchimp.com/api/downloads/#php
and click on Check it out here download the folder and extract it then see.
cloudnclear comments:
Ignore my question. I have found the file :-)
One more thing, what is the code that you have posted here? where should I use it and what is the purpose?
<?php
add_action( 'wpcf7_before_send_mail', 'get_cf7_email' );
function get_cf7_email( $cf7 )
{
$email = $cf7->posted_data["your-email"]; // where your-email is the name of the field of email
// do whatever you want to do with email field like store in db or print it.
echo $email;
}
?>
cloudnclear comments:
I followed all the instructions (besides your code) and I get this error message:
function wpcf7_send_to_mailchimp($cfdata) { $formtitle = $cfdata->title; $formdata = $cfdata->posted_data; $send_this_email = $formdata['your-email']; $mergeVars = array( 'FNAME'=>$formdata['your-first-name'], 'LNAME'=> $formdata['your-last-name'], 'GROUPINGS'=>array( array('name'=>'Form Used', 'groups'=>$formtitle), )); // MCAPI.class.php needs to be in theme folder require_once('MCAPI.class.php'); // grab an API Key from http://admin.mailchimp.com/account/api/ $api = new MCAPI('9745e389574a0e61cb51179cb656806b-us1'); // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/ // Click the "settings" link for the list - the Unique Id is at the bottom of that page. $list_id = "d944ed6130"; // 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);
Warning: Cannot modify header information - headers already sent by (output started at /nfs/c06/h05/mnt/92078/domains/kotelwomen.org/html/wp-content/themes/foundation/functions.php:366) in /nfs/c06/h05/mnt/92078/domains/kotelwomen.org/html/wp-admin/theme-editor.php on line 103
Arnav Joy comments:
this code is to be pasted at functions.php of your file.
it will give show you the email whenever contact form 7 is filled and email is about to send.
so where i have written "echo $email;" , there you can use anything which you want to do with filled email using variable $email
Arnav Joy comments:
have a look in this plugin
http://wordpress.org/extend/plugins/contact-form-7-3rd-party-integration
cloudnclear comments:
I see.
But still, I have followed all your instructions, also copied the function you have sent me and I still get that error..
http://womenofthewall.org.il/
Arnav Joy comments:
remove all the code you pasted as you have pasted it wrongly , try to use the plugin.
cloudnclear comments:
I get error while trying to activate the plug-in you have sent me.
function wpcf7_send_to_mailchimp($cfdata) { $formtitle = $cfdata->title; $formdata = $cfdata->posted_data; $send_this_email = $formdata['your-email']; $mergeVars = array( 'FNAME'=>$formdata['your-first-name'], 'LNAME'=> $formdata['your-last-name'], 'GROUPINGS'=>array( array('name'=>'Form Used', 'groups'=>$formtitle), )); // MCAPI.class.php needs to be in theme folder require_once('MCAPI.class.php'); // grab an API Key from http://admin.mailchimp.com/account/api/ $api = new MCAPI('9745e389574a0e61cb51179cb656806b-us1'); // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/ // Click the "settings" link for the list - the Unique Id is at the bottom of that page. $list_id = "d944ed6130"; // 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);
Warning: Cannot modify header information - headers already sent by (output started at /nfs/c06/h05/mnt/92078/domains/kotelwomen.org/html/wp-content/themes/foundation/functions.php:368) in /nfs/c06/h05/mnt/92078/domains/kotelwomen.org/html/wp-includes/pluggable.php on line 866
Arnav Joy comments:
remove all the code you pasted as you have pasted it wrongly , try to use the plugin.
cloudnclear comments:
Where do I configure the mailchimp API and unique id?
I cannot see it in the plug-in settings.
I still cannot understand what i did wrong in the first solution..
Arnav Joy comments:
in the first method , you have pasted code incorrectly.
this second method is more easy for you
Go to new admin subpage "3rdparty Services" under the CF7 "Contact" menu and configure services + field mapping.
cloudnclear comments:
I didn't paste the code incorrectly.
I also tried to do it again without any luck.
Can you tell me what was wrong?
1. I have uploaded the "MCAPI.class.php" file to the theme folder.
2. I have copy & paste the code (in this page, http://www.bigbossmas.com/wordpress/integrating-contact-form-7-to-mailchimp-the-better-way/) to my "functions.php".
3. I have edited the API and the unique list.
As for the 2nd solution, as mentioned, I cannot see under the plug-in settings mailchimp configuration.
Please see attached.