• Resolved nickamis

    (@nickamis)


    Hi,

    I need to automatically add new users to groups within MailChimp. How do I do this?

    Kind regards, Nick

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nickamis

    (@nickamis)

    I’ve used this code snippet to add users to interest groups when syncing but what happens if the person opts out of a group? Do they get added back in again when the sync takes place?

    https://www.snip2code.com/Snippet/586849/MailChimp-Sync–Add-subscribers-to-an-In

    Plugin Contributor Lap

    (@lapzor)

    Hi,

    Yes, I think they will be re-added when that contact is re-synced (e.g. after something in the contact details changes and a re-sync is triggered).

    Hope that helps. If you have any questions, please let us know!

    @nickamis Where did you get the Group ID From? I’m using MailChimps Playground as suggested, but can’t figure out what ID is the Group ID… that or this code isn’t working.

    The only ID I found is by going to Lists -> “MyList”
    Subresources “interest-categories”
    “MyGroup”

    where I have an alphaneumeric ‘id’ something like 12345ab890

    The result is nothing syncs.

    I’ve tried everything I can think of..

    Hi,

    The code above didn’t work for me, so i used this:

    add_filter( 'mailchimp_sync_subscriber_data', function( $subscriber, $user ) {
        	$subscriber->interests[ "acaee6bb67" ] = true;
        	$subscriber->interests[ "cb9d8ba3ec" ] = true;
        	return $subscriber;
    }, 10, 2 );

    But if a user opts out from a group, i don’t want them to get added back in after the next sync.

    So, after a new registration the user is synced with Mailchimp and directly added to both groups. After that, the user must have the possibility to opt out for one or both of the groups and not automatically get added back in. Is there a possibility for this?

    (maybe check first if one of the groups is already checked out (if yes, don’t update) or only update the groups if a user is new?)

    • This reply was modified 6 years, 1 month ago by justingr.
    • This reply was modified 6 years, 1 month ago by justingr.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatically Add to Groups’ is closed to new replies.