• Resolved darylldelfin

    (@darylldelfin)


    Great plugin!

    I have found this awesome plugin for my needs, but I’m currently having issues.

    Our situation is this :

    1. We have wp users that may or may not be subscribed to a mailchimp list
    2. We have a separate functionality on our site that lets those users subscribe and unsubscribe to that mailchimp list.
    3. We want to sync our user list to the mailchimp list by providing more merge tags/custom fields.

    This is the code that we’re using right now :

    add_filter( 'mailchimp_sync_user_data', function( $data, $user ) {
    
    	$data['IHP_BLOCK'] = get_user_meta( $user->ID, 'ihp_block_number', true );
    	$data['IHP_FLOOR'] = get_user_meta( $user->ID, 'ihp_floor_number', true );
    	$data['IHP_UNIT']  = get_user_meta( $user->ID, 'ihp_unit_number', true );
    	$data['IHP_ROLE']  = $user->roles ? ucwords(str_replace('_', ' ', array_values($user->roles)[0])) : false;
    	$data['IHP_RES']   = get_user_meta( $user->ID, 'ihp_resident', true ) == 1 ? 'Resident' : 'Non-Resident';
    
        return $data;
    }, 10, 2 );

    We do the manual sync for testing.

    Also, obviously we do not want everyone to be ‘subscribed’ once I hit sync because some of those users are currently unsubscribed. So based on the docs, we used this filter as well :

    add_filter( 'mailchimp_sync_should_sync_user', function( $subscribe, $user ) {
    
    	// check for custom user field
    	if( get_user_meta( $user->ID, 'mailchimp_subscribe', true ) == '1' ) {
    		return true;
    	}
    
    	// do not subscribe otherwise
    	return false;
    });
    
    

    What happens when I hit Manual Synchronization > Synchronize All is it seems to run fine and all of the users are being updated.

    But when I take a look at the mailchimp list after, the list isn’t updated. All of the users don’t have the additional merge tags filled even if they are already setup on mailchimp.

    What do you think is the cause of this issue? Are we doing something wrong here?

    Please take a look.

    Thanks,
    Daryll

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘User Sync Issues’ is closed to new replies.