Syncing Interests / ‘Groups subscribed to’
-
Hi,
I’m struggling to work out how to sync interest data. I am attempting to use the filter ‘mailchimp_sync_subscriber_data’ (which I believe has superseded ‘mailchimp_sync_user_data’ which I’ve also tried) but this does not appear to be firing (I’m writing to the error_log at the beginning of this filter and nothing appears). I need it to be part of the automatic sync but have tried the manual syncs (individual and all users) just as a test (still nothing written out).
I am successfully syncing users/subscribers and some standard fields (First Name, Last Name) and also have the webhook working in the reverse direction for the same data.
Here’s the code I’m using:
add_filter( 'mailchimp_sync_subscriber_data', 'add_users_to_groups', 10, 2); function add_users_to_groups( $subscriber, $user ) { write_log('syncing subscriber data'); write_log($subscriber); write_log($user); $friend_status = esc_attr(get_the_author_meta( 'friend_status', $user->ID )); $is_friend = isset($friend_status) && $friend_status === 'friend'; $subscriber->interests[ "e3c89487ec" ] = $is_friend; $subscriber->interests[ "b7fabe0c33" ] = !$is_friend; return $subscriber; }
Hope you can help.
Thanks
- The topic ‘Syncing Interests / ‘Groups subscribed to’’ is closed to new replies.