Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save strangerstudios/4206776 to your computer and use it in GitHub Desktop.
Save strangerstudios/4206776 to your computer and use it in GitHub Desktop.
BCC all Paid Memberships Pro Emails to a Certain Address
/*
Bcc admin on PMPro member only emails
You can change the conditional to check for a certain $email->template or some other condition before adding the BCC.
*/
function my_pmpro_email_headers($headers, $email)
{
//bcc emails not already going to admin_email
if($email->email != get_bloginfo("admin_email"))
{
//add bcc
$headers[] = "Bcc:" . get_bloginfo("admin_email");
}
return $headers;
}
add_filter("pmpro_email_headers", "my_pmpro_email_headers", 10, 2);
@mcaravaglia
Copy link

Jason,
The gistfile above was provided to me from Stranger Studios to use for Paid Membership Pro. I am a bit of a novice developer here, so I am curious to know exactly where I paste this code? I assume it is .php and gets placed into th PMP plug-in? Can you advise?
Thank you.

@strangerstudios
Copy link
Author

Do not update the PMPro plugin files. Paste this into your active theme's functions.php file or a custom plugin. More info on creating a custom plugin here:
http://www.paidmembershipspro.com/2012/08/create-a-plugin-for-pmpro-customizations/

@rwilki
Copy link

rwilki commented Mar 18, 2014

Thanks Jason. I'm going to try this. Some of the other gists didn't work for me. Is there a benefit to using this code in a custom plugin over the functions file or vice versa?

@BertPC
Copy link

BertPC commented May 3, 2014

rwilki +1

@strangerstudios
Copy link
Author

Is there a benefit to using this code in a custom plugin over the functions file or vice versa?

Late reply, but if you put it in a custom plugin you won't lose the functionality if you change your theme and it's also easier to copy to another site that isn't using the same theme.

In general, code in the theme folder (including the functions.php) should all be related to themey type stuff (visuals, design, frontend stuff) and customizations like this should go into a custom plugin. However, the functions.php of the active theme is something that 99% of WP sites already have and is a quick way to get one little customization onto a WP site.

@abdolnabizzz
Copy link

abdolnabizzz commented Nov 30, 2018

Hello there,
I need to know, how should I send CC/BCC on new registration to 4 emails addresses?

@laurenhagan0306
Copy link

This recipe is included in the blog post on "BCC Additional Email Addresses on Member or Admin Notifications" at Paid Memberships Pro here: https://www.paidmembershipspro.com/bcc-additional-email-addresses-on-member-or-admin-notifications/

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