[!mailchimpSubscribe?form=`mailchimpForm` &listId=`000050477e`!] [!mailchimpList!]
if (!$retVal) { if ($debug == true) { $debugOutput .= "Unable to load listSubscribe()!\n"; $debugOutput .= "\tCode=".$api->errorCode."\n"; $debugOutput .= "\tMsg=".$api->errorMessage."\n"; } $modx->setPlaceholder('MailChimp.message', 'There was a problem subscribing you');
$retVal = $api->listSubscribe($listId, $_POST['mc_EMAIL'], $mergeVars);
$retVal = $api->listSubscribe($listId, $_POST['EMAIL'], $mergeVars);
<?php $apikey = 'YOUR MAILCHIMP APIKEY';
$api = new MCAPI($username, $password);
$api = new MCAPI($apikey);
<p>[[+MailChimp.message]]</p> <form method="post" action="[[~[[*id]]]]"> <label>First Name: <input type="text" name="mc_FNAME" value="" /></label><br /> <label>Last Name: <input type="text" name="mc_LNAME" value="" /></label><br /> <label>Email: <input type="text" name="mc_EMAIL" value="" /></label> <input type="submit" name="subscribe" value="Subscribe" /> </form>
[[!mailchimpSubscribe?form=`mailchimpForm` &listId=`<YOUR LIST ID>`]]
I managed to get this working in Revolution. I’ve removed the need for the username&password and now only require an API key. So, starting from Garry’s snippet, do the following:
EDIT: Forgot to mention you need to update the API to 1.3 - I just added this at point 2.
1) Find your Mailchimp API key in Mailchimp by going to Account (very top left) -> API Keys & Info (bottom). The key will look something like 45g7453redf3b26r019d230a543e84fg-us2
2) Download the latest Mailchimp PHP API (as of this post, 1.3) - http://www.mailchimp.com/api/downloads/#php. Replace the API in classes/MCAPI.class.php with the one you just downloaded.
3) Erase everything in config.inc.php and replace with:
<?php $apikey = 'YOUR MAILCHIMP APIKEY';
4) In the snippet code (subscribe.snippet.php), go to line 20 and replace
$api = new MCAPI($username, $password);
with
$api = new MCAPI($apikey);
5) Replace the chunk (subscribe.form.tpl), with the following. It changes the evo tags to revo and swaps mc_FIRST/mc_LAST with mc_FNAME and mc_LNAME (what MC will expect):
<p>[[+MailChimp.message]]</p> <form method="post" action="[[~[[*id]]]]"> <label>First Name: <input type="text" name="mc_FNAME" value="" /></label><br /> <label>Last Name: <input type="text" name="mc_LNAME" value="" /></label><br /> <label>Email: <input type="text" name="mc_EMAIL" value="" /></label> <input type="submit" name="subscribe" value="Subscribe" /> </form>
5) Snippet call becomes: (evo->revo)
[[!mailchimpSubscribe?form=`mailchimpForm` &listId=`<YOUR LIST ID>`]]
That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.
That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.
I managed to get this working in Revolution. I’ve removed the need for the username&password and now only require an API key. So, starting from Garry’s snippet, do the following:
EDIT: Forgot to mention you need to update the API to 1.3 - I just added this at point 2.
1) Find your Mailchimp API key in Mailchimp by going to Account (very top left) -> API Keys & Info (bottom). The key will look something like 45g7453redf3b26r019d230a543e84fg-us2
2) Download the latest Mailchimp PHP API (as of this post, 1.3) - http://www.mailchimp.com/api/downloads/#php. Replace the API in classes/MCAPI.class.php with the one you just downloaded.
3) Erase everything in config.inc.php and replace with:
<?php $apikey = 'YOUR MAILCHIMP APIKEY';
4) In the snippet code (subscribe.snippet.php), go to line 20 and replace
$api = new MCAPI($username, $password);
with
$api = new MCAPI($apikey);
5) Replace the chunk (subscribe.form.tpl), with the following. It changes the evo tags to revo and swaps mc_FIRST/mc_LAST with mc_FNAME and mc_LNAME (what MC will expect):
<p>[[+MailChimp.message]]</p> <form method="post" action="[[~[[*id]]]]"> <label>First Name: <input type="text" name="mc_FNAME" value="" /></label><br /> <label>Last Name: <input type="text" name="mc_LNAME" value="" /></label><br /> <label>Email: <input type="text" name="mc_EMAIL" value="" /></label> <input type="submit" name="subscribe" value="Subscribe" /> </form>
5) Snippet call becomes: (evo->revo)
[[!mailchimpSubscribe?form=`mailchimpForm` &listId=`<YOUR LIST ID>`]]
That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.