Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/2db0980fc1a80ea73c9aca52af77078e to your computer and use it in GitHub Desktop.
Save ipokkel/2db0980fc1a80ea73c9aca52af77078e to your computer and use it in GitHub Desktop.
BCC a copy of recurring payment reminder emails to an additional email address, e.g. admin.
<?php
/**
* Send a copy of an Invoice email i a member has specified and additional invoice email addresses.
*
* This recipe require an additional email address to be set in usermeta table.
*
* Collecting an additional invoice email address should be achievable with a custom User Field.
* @link https://www.paidmembershipspro.com/documentation/user-fields/
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_headers_bcc_on_recurring_email( $headers, $email ) {
if ( strpos( $email->template, 'membership_recurring' ) !== false ) {
//add bcc
$headers[] = 'Bcc:' . 'otheremail@domain.com'; //change to your email address
}
return $headers;
}
add_filter( 'pmpro_email_headers', 'my_pmpro_email_headers_bcc_on_recurring_email', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment