Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@femiyb
Created April 1, 2019 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save femiyb/e7311cd08cd61d38d616d2850fc2381d to your computer and use it in GitHub Desktop.
Save femiyb/e7311cd08cd61d38d616d2850fc2381d to your computer and use it in GitHub Desktop.
<?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