Created
September 7, 2023 19:42
-
-
Save ipokkel/1ea35c55439f07ccc34265ff117a239d 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 | |
/** | |
* Do not sent recurring payment reminder email if last order gateway is check. | |
* | |
* This may be useful to stop sending reminder emails to members already receiving | |
* pay by check email reminders. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprorm_dont_send_reminder_to_pbc( $send_mail, $user, $lastorder ) { | |
// Let's only do this if Pay By Check is active. | |
if ( ! function_exists( 'pmpropbc_reminder_emails' ) ) { | |
return $send_mail; | |
} | |
// if lastorder gateway is check, return false. | |
if ( 'check' === $lastorder->gateway ) { | |
return false; | |
} | |
return $send_mail; | |
} | |
add_filter( 'pmprorm_send_reminder_to_user', 'my_pmprorm_dont_send_reminder_to_pbc', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment