• I am having trouble adding custom mail merge fields for MailChimp.

    The only instructions I have seen to edit s2-hacks.php is “adjust as necessary.”

    The s2member Custom Registration/Profile Fields contains a field with a Unique ID of street_address and MailChimp has the field tag of SA, so I thought I should add
    ‘SA’ => $args->street_address,
    to /wp-content/mu-plugins/s2-hacks.php

    The log record shows the SA, but no street_address from the registration form. How do I get the street_address to transfer to MailChimp?

    [api_merge_array] => Array
    (
    [MERGE1] => Ian
    [MERGE2] => Wright
    [OPTIN_IP] => 108.17.132.38
    [OPTIN_TIME] => 2015-11-14 13:08:03
    [ROLE] => subscriber
    [LEVEL] => 0
    [CCAPS] =>
    [LOGIN] => IanWright
    [USER_ID] => 101040
    [SA] =>
    )

    /wp-content/mu-plugins/s2-hacks.php
    <?php
    add_filter(‘ws_plugin__s2member_mailchimp_merge_array’, function ($custom_fields, $vars)
    {
    $args = &$vars[‘args’]; // stdClass object.
    # print_r($args); // for a full list of all properties.

    $custom_fields = array_merge($custom_fields, array(
    ‘ROLE’ => $args->role,
    ‘LEVEL’ => $args->level,
    ‘CCAPS’ => $args->ccaps,
    ‘LOGIN’ => $args->login,
    ‘USER_ID’ => $args->user_id,
    ‘SA’ => $args->street_address,
    ));
    return $custom_fields;

    // Note that custom fields (aka: merge tags) will NOT work unless & until they are created by
    // a site owner working inside their MailChimp account. They must first add the custom fields
    // so they can be filled by the s2Member filter seen here.

    // See: <http://kb.mailchimp.com/merge-tags/using/getting-started-with-merge-tags&gt;
    }, 10, 2);
    add_filter(“ws_plugin__s2member_mailchimp_double_optin”, “__return_false”);

    https://wordpress.org/plugins/s2member/

  • The topic ‘trouble adding custom mail merge fields for MailChimp’ is closed to new replies.