Created
November 22, 2022 14:14
-
-
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.
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 | |
/** | |
* 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