The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Mailchimp plugin for 3.8.7: What do I need to modify?
Hi, this code is working great on the site where I found it, http://www.bestrecipes.com.au/site/mailchimp.html, that is running 3.8.3 but not on my board that is 3.8.7.
This is the plugin code: Code:
require_once 'mailchimp/MCAPI.class.php'; // location of API file, relative to forum root directory $apikey= 'myapikey-us2'; // your API key $listId = '3af3706004321'; // the list ID // Connect to the MailChimp server $api = new MCAPI($apikey); if ($api->errorCode!=''){ // an error occurred while logging in, errors commented in HTML echo "<!-- code:".$api->errorCode."-->"; echo "<!-- msg :".$api->errorMessage."-->"; die(); } // get current user details $my_email=($vbulletin->userinfo['email']); // profile fields are best set up as single-selection radio buttons, // use multiple profile fields for interest groups and mail format // vBulletin profile field options: // use Yes/No options (use HTML/Text for mail format) // Set default: Yes // Field Required: No but display at registration // Field Editable by User: Only at registration // Handle unsubscribes and profile updating via links in mailings, or another API plugin $news1=($vbulletin->userinfo['field12']); // add custom profile field number for interest group 1 // $news2=($vbulletin->userinfo['field14']); // add custom profile field number for interest group 2 // $news3=($vbulletin->userinfo['field15']); // add custom profile field number for interest group 3 $newsformat=strtolower(($vbulletin->userinfo['field13'])); // profile field number for mail format, html or text // add interest group names, note trailing commas in all but last one - a quick hack but it works! if ($news1=='Yes') { $interests='Interest group name here,'; // escape apostrophes in name with a backslash i.e. What\'s On } if ($news2=='Yes') { $interests.='Interest group name here,'; } if ($news3=='Yes') { $interests.='Interest group name here'; } $merge_vars = array('INTERESTS'=>$interests); // only send request if subscribed to at least 1 newsletter if ($news1=='Yes' || $news2=='Yes' || $news3=='Yes') { $retval = $api->listSubscribe( $listId, $my_email, $merge_vars, $newsformat ); } if (!$retval){ // return error codes, commented in HTML echo "<!--Newsletter failed!-->"; echo "<!--\tCode=".$api->errorCode."-->"; echo "<!--\tMsg=".$api->errorMessage."-->"; // email backup for API failures, multiple subscribes etc. $to = 'info@musicadigitale.net'; $subject = 'Newsletter API failed'; $message = "The following member details were not subscribed by the API:\n"; $message .= "Email: $my_email\n"; $message .= "Interest groups: $interests\n"; $message .= "Mail format: $newsformat\n"; $message .= "Error message: " . $api->errorMessage . ""; $headers = "From: MailChimp API <adminemail@domain.com>\n"; $headers .= "Reply-To: adminemail@domain.com\n"; $headers .= "X-Mailer: Your forum name\n"; mail($to, $subject, $message, $headers); } else { echo "<!--Newsletter subscribed ok-->"; } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|