Skip to content

s2_admin_email

  • Subscribe2
  • Updated Nov 23, 2023
  • 1 min read

Subscribe2 can be configured to send an email to all Administrator level users every time a public subscriber subscriber or unsubscribes. You may want to send these emails but change the list of recipients. The ‘s2_admin_email’ makes that possible.

The hook takes two variables, the list of recipients in array form and the type of email being sent. You can amend the array or completely replace it. You can also carry out different actions for the two email types.

function my_admin_filter($recipients = array(), $email) {
// $recipients is an array of admin email addresses
// $email will be 'subscribe' or 'unsubscribe'
if ($email == 'subscribe') {
foreach ($recipients as $key => $email) {
if ( $email == 'admin@mysite.com') {
unset($recipients[$key]);
}
}
$recipients[] = 'different.user@mysite.com';
}
return $recipients;
}
add_filter('s2_admin_email', 'my_admin_filter', 10, 2);

Last updated on

Filed under Hooks, API & Customization

Still stuck?

Our support team can walk you through it.