Multisite Auth MailChimp Addon lets you easily opt-in users from your WordPress network registration forms
PHP JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
includes
languages
index.html
license.txt
muauth-mailchimp.php
readme.md
uninstall.php

readme.md

MailChimp for Multisite Auth

Multisite Auth MailChimp Addon lets you easily opt-in users from your WordPress network registration forms.

This plugin uses MailChimp API lib by @drewm to make API calls with MailChimp servers.

This plugin requires the parent plugin Multisite Auth

Preview

admin setings preview

register form preview

Hook into opt-in

add_action('muauth_mc_catch_optin_response', function($response, $user_email, $lists){
	// loop through lists
	foreach ( $lists as $list_id ) {
		$res = $response[$list_id];

		if ( muauth_mc_status_success( $res['succes'] ) ) {
			// this email ($user_email) was successfully opted-in, do actions
		} else {
			// error occured, could not opt-in, debug $res
		}
	}
}, 10, 3);

Update user after signup success

By default, the only information inserted to the mailing list is the email address. But there is a method to edit the list signup to add more information:

$MailChimp = muauth_mc();
$list_id = 'b1234346';
$subscriber_hash = $MailChimp->subscriberHash('davy@example.com');
$result = $MailChimp->patch("lists/$list_id/members/$subscriber_hash", [
    'merge_fields' => ['FNAME'=>'Davy', 'LNAME'=>'Jones'],
    'interests'    => ['2s3a384h' => true],
]);

print_r($result);