Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#36970 closed enhancement (duplicate)

wp_new_user_notification disable admin email but allow user email

Reported by: jshrek's profile jshrek Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: General Keywords:
Focuses: Cc:

Description

I would like to suggest a simple patch to the wp_new_user_notification function that would allow you send the user their email but disable to admin notification email.

Currently you can either send an email to both the user and the admin, or the admin only but there is no option to send email to the user only.

So currently if I look at source:tags/4.5/src/wp-includes/pluggable.php at line 1719 we have this line which sends the email to the admin:

<?php
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);

My suggestion is as follows:

<?php
    //Allow ability to disable email to admin but still send email to the user.
    // If $notify is 'admin' then email will only be sent to admin user but not to user.
    // If $notify is 'both' then email will be sent to admin and to user.
    // If $notify is '' (blank) then email will be sent to admin and to user.
    // If $notify is anything else (like 'user') then email will only be sent to user but not to admin.
    if ('admin' === $notify || 'both' === $notify || '' === $notify) { 
       @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
    }

Not sure how I can submit this patch, but I have attached the function with the changes.

Attachments (1)

wp_new_user_notification.php (2.6 KB) - added by jshrek 9 years ago.
Suggested patch for wp_new_user_notification

Download all attachments as: .zip

Change History (3)

@jshrek
9 years ago

Suggested patch for wp_new_user_notification

#1 @boonebgorges
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @jshrek - Thanks for the ticket, and welcome to WordPress Trac!

This idea was proposed and the enhancement was added to WordPress in [37276]. See #36009.

#2 @jshrek
9 years ago

Oops sorry. Thanks for pointing that out!

Note: See TracTickets for help on using tickets.