Forked from andrewlimaza/bcc-admin-email-for-a-level.php
Created
October 1, 2019 08:39
-
-
Save travislima/22350316a3fd0c224bea5ebd48bccdb2 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
This recipe is included in the blog post on "BCC Additional Email Addresses on Admin Notifications for Specific Membership Levels" at Paid Memberships Pro here: https://www.paidmembershipspro.com/bcc-additional-email-addresses-on-admin-notifications-for-specific-membership-levels/