• Resolved vermadililpjpr

    (@vermadililpjpr)


    Hi,

    I have two Admin users on my site and I want to disable email notification for one user(or How I can change recipient email address) when a new subscriber is subscribed on the site.

    I checked all the setting options but I can’t figure out how to disable this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @vermadililpjpr

    This is possible with a little code using the plugins API. See the hook s2_admin_email here:
    https://subscribe2.wordpress.com/support/api/

    CreativeCaro

    (@creativecaro)

    Thanks for including that link that shows the snippet but I’m not sure HOW to modify it. For example, I ONLY want one specific admin user to receive all notifications. Here’s what I did but I have no idea if this is right. The (fake) email address where I want to send notifications is [email protected] in this example.

    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 != '[email protected]') {
                    unset($recipients[$key]);
                }
            }
            $recipients[] = '[email protected]';
        }
       else if ($email == 'unsubscribe') {
            foreach ($recipients as $key => $email) {
                if ( $email != '[email protected]') {
                    unset($recipients[$key]);
                }
            }
            $recipients[] = '[email protected]';
        }
        return $recipients;
    }
    add_filter('s2_admin_email', 'my_admin_filter', 10, 2);

    Any help or pointers would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to change admin email recipient.’ is closed to new replies.