• Resolved qudsiyyamehtab

    (@qudsiyyamehtab)


    Hello,

    I have a custom registration page and I am using following code to integrate mailchimp within my registration form
    <p>
    <label>
    <input type=”checkbox” name=”mc4wp-subscribe” value=”1″ />
    Subscribe to our newsletter. </label>
    </p>
    Also it is integrated with one of my mailing list in mailchimp. The problem is that when the user registers, only his email, first name and last name are imported into the mailing list.I also want rest of the fields to appear in the mailing list as well. The fields are updated in the mailchimp list once the usersync is run but it does not appear initially.

    I have phone, age, gender, visa etc fields

    I came across the following function to get custom fields but it doesnt seem to work

    add_filter( ‘mailchimp_sync_user_data’, function( $data, $user ) {
    $data[‘MERGE3’] = $user->phone;
    $data[‘MERGE5’] = $user->visa;
    $data[‘MERGE6’] = $user->location;
    $data[‘MERGE7’] = $user->age;
    $data[‘MERGE8’] = $user->gender;
    $data[‘MERGE9’] = $user->preference1;
    $data[‘MERGE10’] =$user->preference2;
    $data[‘MERGE11’] = $user->preference3;
    $data[‘MERGE12’] = $user->mc4wp-subscribe;
    return $data;
    }, 10, 2 );

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter qudsiyyamehtab

    (@qudsiyyamehtab)

    I have been able to send visa, location,age and gender which are all text fields. Having trouble with phone which is a text field as well and preference1,preference2,preference3 and mc4wp-subscribe which are all checkboxes.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    Can you please let us know if you have tried setting up the sync fields using the user interface provided on the “User Sync” settings page? If not, can you please try it out first?

    Thread Starter qudsiyyamehtab

    (@qudsiyyamehtab)

    Hello,

    Thank you for your message. I have tried syncing the fields through usersync also but that didnt help.

    In the end I found this post https://kb.mc4wp.com/send-additional-cf7-fields-mailchimp/. I am not using cf7 form but the same steps helped with my custom registration form i.e.
    using mc4wp- prefix for field names in the form mc4wp-FIELDNAME
    using the same fieldname in mailchimp for field label as well as mergetag and then using ‘mailchimp_sync_user_data’ filter in functions.php

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘custom user fields in mailchimp’ is closed to new replies.