WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#36009 closed enhancement (fixed)

wp_new_user_notification "user" option for third parameter

Reported by: Jonathandejong Owned by: SergeyBiryukov
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.4.2
Component: Users Keywords: has-patch needs-unit-tests
Focuses: administration Cc:

Description

I propose adding a third option for the third parameter $notify in wp_new_user_notification() called "user" (string) which would allow for sending the notification to the user only. Many user-driven sites have the need for sending this email to new users but would rather not flood an admin email with registration notifications.

I don't think this only flaw is enough to justify plugging the function with a custom one. It'd be much preferred to allow for this third option in the core function instead.

Attachments (2)

36009.diff (1.8 KB) - added by akibjorklund 2 years ago.
36009.2.diff (2.3 KB) - added by akibjorklund 2 years ago.

Download all attachments as: .zip

Change History (15)

@akibjorklund
2 years ago

#1 @akibjorklund
2 years ago

I agree this would be a useful addition. I've attached 36009.diff which adds this functionality. The few lines indented by the if block added are also fixed for spacing issues to adhere to the WordPress coding standards.

#2 @akibjorklund
2 years ago

  • Keywords has-patch needs-testing added

#3 @boonebgorges
2 years ago

  • Keywords needs-docs added
  • Milestone changed from Awaiting Review to 4.6

Patch seems pretty good to me. Can we get a @since annotation for the new accepted value?

@akibjorklund
2 years ago

#4 @akibjorklund
2 years ago

Indeed. Patch updated.

#5 @Jonathandejong
2 years ago

Great to hear!

#6 @DrewAPicture
2 years ago

  • Keywords commit added; needs-docs removed

The changelog entry in 36009.2.diff looks good.

#7 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 37276:

Users: In wp_new_user_notification(), sdd 'user' option for the $notify parameter, which allows for sending notification only to the user created.

Props akibjorklund.
Fixes #36009.

#8 follow-up: @ocean90
2 years ago

  • Keywords needs-unit-tests added; needs-testing commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm shocked that this landed without a unit test. May I remind you about [35735]?

Also,wp_send_new_user_notifications() is a wrapper for wp_new_user_notification() and should get a note about the new parameter too.

#9 @SergeyBiryukov
2 years ago

In 37277:

Users: Add a unit test for [37276].

See #36009.

#10 in reply to: ↑ 8 @SergeyBiryukov
2 years ago

Replying to ocean90:

I'm shocked that this landed without a unit test. May I remind you about [35735]?

Right, sorry for that. Thanks for reminding :)

#11 @SergeyBiryukov
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 37278:

Docs: Reflect the new 'user' option for wp_new_user_notification()'s $notify parameter added in [37276] in wp_send_new_user_notifications() docs as well.

Props ocean90.
Fixes #36009.

#12 @boonebgorges
2 years ago

#36970 was marked as a duplicate.

#13 @jshrek
2 years ago

I submitted the following suggestion here https://core.trac.wordpress.org/ticket/36970 which turns out to be a duplicate of this one!

Adding a user email only option is great idea.

Note: See TracTickets for help on using tickets.