Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save travislima/22350316a3fd0c224bea5ebd48bccdb2 to your computer and use it in GitHub Desktop.
Save travislima/22350316a3fd0c224bea5ebd48bccdb2 to your computer and use it in GitHub Desktop.
BCC email addresses based on membership level.
<?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);
@laurenhagan0306
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment