Created
March 10, 2017 19:34
-
-
Save strangerstudios/33aec72377b5d04fdc8416aa754f6df4 to your computer and use it in GitHub Desktop.
Disable member emails for specific levels.
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
function my_pmpro_disable_member_emails($recipient, $email) | |
{ | |
$user = get_user_by('login', $email->data['user_login']); | |
$level = pmpro_getMembershipLevelForUser($user->ID); | |
$disabled_levels = array(1,2,3); //update this to include ids of all levels you want to disable emails for | |
if(!empty($level) && !empty($level->id) && in_array($level->id, $disabled_levels)) | |
$recipient = NULL; | |
return $recipient; | |
} | |
add_filter("pmpro_email_recipient", "my_pmpro_disable_member_emails", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment