Created
September 10, 2019 13:31
-
-
Save andrewlimaza/e83b1f032d590929ba4697316f457e89 to your computer and use it in GitHub Desktop.
BCC email addresses based on membership level.
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 | |
/** | |
* Tweaked from BCC Admin on Member Emails - https://www.paidmembershipspro.com/bcc-additional-email-addresses-on-member-or-admin-notifications/ | |
* Add this code to your PMPro Customizations Plugin. | |
* Adjust the membership ID to match that of your levels. | |
*/ | |
function my_pmpro_email_headers( $headers, $email ) { | |
// Default BCC address to default email address. | |
$admin_email = get_bloginfo("admin_email"); | |
if ( intval( $email->data['membership_id'] ) == 5 ) { | |
$admin_email = 'someemail@email.com'; | |
} | |
//bcc emails not already going to admin_email | |
if ( $email->email != get_bloginfo( "admin_email" ) ) { | |
$headers[] = "Bcc:" . $admin_email; | |
} | |
return $headers; | |
} | |
add_filter("pmpro_email_headers", "my_pmpro_email_headers", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment