Last active
February 12, 2021 13:40
-
-
Save femiyb/676b53e9f38d5f14671696cbdaf738b0 to your computer and use it in GitHub Desktop.
Send approval e-mails to pmpro approver role
This file contains hidden or 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 | |
function my_pmpro_email_headers_approval_emails($headers, $email) | |
{ | |
$args = array('role' => 'pmpro_approver'); | |
$pmpro_approvers = get_users($args); | |
$pmpro_approvers_emails = array(); | |
foreach($pmpro_approvers as $pmpro_approver) | |
{ | |
$pmpro_approvers_emails[] = $pmpro_approver->user_email; | |
} | |
if(strpos($email->template, "admin_notification") !== false) | |
{ | |
$headers[] = "Bcc:" . implode(',', $pmpro_approvers_emails); | |
// $headers[] = "Bcc:" . "[email protected],[email protected]"; | |
} | |
return $headers; | |
} | |
add_filter("pmpro_email_headers", "my_pmpro_email_headers_approval_emails", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment