Skip to content

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

License

Notifications You must be signed in to change notification settings

DevriX/muauth-mailchimp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published