Created
September 30, 2016 18:46
-
-
Save strangerstudios/9e9f2b2eca301f906f38d55b42fdb7e6 to your computer and use it in GitHub Desktop.
Make !!startdate!! and !!enddate!! available for all Paid Memberships Pro emails.
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
/* | |
Make !!startdate!! and !!enddate!! available for all PMPro emails. | |
Add this code to a custom plugin. | |
*/ | |
function my_pmpro_email_data($data, $email) { | |
$user = get_user_by("login", $data['user_login']); | |
$level = pmpro_getMembershipLevelForUser($user->ID); | |
if(!empty($level->startdate)) | |
$data['startdate'] = date_i18n(get_option('date_format'), $level->startdate); | |
else | |
$data['startdate'] = ''; | |
if(!empty($level->enddate)) | |
$data['enddate'] = date_i18n(get_option('date_format'), $level->enddate); | |
else | |
$data['enddate'] = ''; | |
return $data; | |
} | |
add_filter("pmpro_email_data", "my_pmpro_email_data", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment