Forked from strangerstudios/my_pmpro_mailchimp_listsubscribe_fields.php
Last active
May 18, 2018 15:09
-
-
Save itsjusteileen/9300e56f70b72eeffa14b36762837dcf to your computer and use it in GitHub Desktop.
Example of using the pmpro_mailchimp_listsubscribe_fields filter to send extra fields to MailChimp.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sync fields to MailChimp | |
*/ | |
function sidetrack_mailchimp_listsubscribe_fields($fields, $user) | |
{ | |
$new_fields = array( | |
"NEWSLETTER SELECTION" => $user->sidetrack_newsletter_selection); | |
$fields = array_merge($fields, $new_fields); | |
return $fields; | |
} | |
add_action('sidetrack_mailchimp_listsubscribe_fields', 'sidetrack_mailchimp_listsubscribe_fields', 10, 2); | |
/* | |
(Optional) Tell PMPro MailChimp to always synchronize user profile updates. By default it only synchronizes if the user's email has changed. | |
Requires PMPro Mailchimp v2.0.3 or higher. | |
*/ | |
add_filter('pmpromc_profile_update', '__return_true'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment