Created
December 16, 2019 12:05
-
-
Save dparker1005/ab755e9a788503f117fa28bafae23a43 to your computer and use it in GitHub Desktop.
Prevents a cancellation email from being set if the user was assigned a new membership level during the cancellation process.
This file contains hidden or 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 | |
// Copy from below here | |
/* | |
* Prevents a cancellation email from being set if the user | |
* was assigned a new membership level during the cancellation | |
* process. | |
*/ | |
function my_pmpro_disable_incorrect_cancellation_emails($recipient, $email) | |
{ | |
if ( strpos($email->template, "cancel") !== false ) { | |
$user = get_user_by( 'login', $email->data['user_login'] ); | |
if ( pmpro_hasMembershipLevel( null, $user->ID ) ) { | |
$recipient = NULL; | |
} | |
} | |
return $recipient; | |
} | |
add_filter("pmpro_email_recipient", "my_pmpro_disable_incorrect_cancellation_emails", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment