Forked from greathmaster/pmpro-mailchimp-merge-fields-enddate.php
Created
October 22, 2019 13:01
-
-
Save femiyb/373ec2bc5a16e63fbe39b80e209b4c13 to your computer and use it in GitHub Desktop.
Send the MERGE field enddate 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
<?php | |
function my_pmpro_mailchimp_listsubscribe_fields($fields, $user) | |
{ | |
$level = pmpro_getMembershipLevelForUser($user->ID); | |
$enddate = date('Y-m-d', $level->enddate); | |
$new_fields = array("ENDDATE" => $enddate); | |
$fields = array_merge($fields, $new_fields); | |
return $fields; | |
} | |
add_action('pmpro_mailchimp_listsubscribe_fields', 'my_pmpro_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