Created
April 1, 2019 11:29
-
-
Save femiyb/e7311cd08cd61d38d616d2850fc2381d to your computer and use it in GitHub Desktop.
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 | |
/* | |
Disable the "Membership Recurring" emails in Paid Memberships Pro | |
*/ | |
function my_pmpro_email_recipient($recipient, $email) | |
{ | |
$user = get_user_by( $email, $recipient ); | |
$user_level = pmpro_getMembershipLevelForUser( $user ); | |
// if user level is 4 and template is membership_recurring. | |
if ( $user_level->ID == '4' && strpos( $email->template, "membership_recurring" ) !== false ) { | |
$recipient = NULL; //remove the recipient to stop email from sending. | |
} | |
return $recipient; | |
} | |
add_filter("pmpro_email_recipient", "my_pmpro_email_recipient", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment