• Thx for this plugin, it’s very helpfull.

    I’m looking to synchronize all accounts with some user metas, it seems it’s only possible to do that with the Mailjet widget.

    Wordpress has the wonderfull “hooks” tools to allow plugins (and core) customization. With that, it can be easy to get more functionnality with mailjet.

    I do a patch, can be usefull for anybody, may be can be added on original code source

    On src/includes/SettingsPages/SubscriptionOptionsSettings.php, in “syncContactsToMailjetList” method, simply replace

                $contacts[] = array(
                    'Email' => $user->user_email,
                    'Name' => $userNames,
                    'Properties' => $contactProperties
                );

    by

                $contact = array(
                    'Email' => $user->user_email,
                    'Name' => $userNames,
                    'Properties' => $contactProperties
                );
                $contact = apply_filters('mailjet_sync_contacts_to_list', $contact, $user, $userInfo, $userMetadata);
                $contacts[] = $contact;

    With this change, you can add a filter to get you own meta_data. Here is an example :

    // the code synchtonise user locale and nickname to mailjet locale and nickname properties
    add_filter('mailjet_sync_contacts_to_list', function($contact, $user, $userInfo, $userMetadata) {
        $contact['Properties']['locale'] = (bool) $userMetadata['locale'][0];
        $contact['Properties']['nickname'] = (bool) $userMetadata['nickname'][0];
    
        return $contact;
    }, 10, 4);

    I’m not using svn since 10 years, I apologize to give the patch like this !

    • This topic was modified 5 years, 1 month ago by v.guerard.
  • The topic ‘Allow more data to synchronize’ is closed to new replies.