Syncing multiple user roles to MC interest group
-
Hi Folks,
Has anyone had any luck using the first section of code at https://github.com/ibericode/mc4wp-snippets/blob/master/add-ons/user-sync/groupings-based-on-role.php
I have two user roles I am trying to sync with an interest group in a MC list and came across the code and a few posts in this support forum. I’ve copied the code and put it in my child theme’s function.php, but it doesn’t seem to work. I’ve tried a manual sync, but still nothing.
Here’s my code:
add_filter( ‘mailchimp_sync_subscriber_data’, function( $data, $user ) {
$data->interests[ ‘a7d0f75cda’ ] = in_array( ‘Candidate’, $user->roles );
$data->interests[ ’35fd830a28′ ] = in_array( ‘Employer’, $user->roles );
//you can repeat this line for more groups / roles.//finally return the data
return $data;
}, 14, 2 );When I ran the manual sync it went through all the users and reported a successful update, but nothing changed in my MC list.
Any help would be greatly appreciated.
Thanks,
Nick
- The topic ‘Syncing multiple user roles to MC interest group’ is closed to new replies.