WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 8 days ago

#11210 new enhancement

Split wp_new_user_notification() into two functions

Reported by: sirzooro Owned by: westi
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Login and Registration Keywords: has-patch
Focuses: Cc:

Description

wp_new_user_notification() sends emails to newly registered user and to admin. One of my plugins (WyPiekacz) redefines it in order to to disable emails sent to admin. Now I want to extend my other plugin (User Locker) so newly registered users will have to activate theirs accounts by clicking on link sent in email. In order to do this, I have to redefine the same function. I how to do this so both plugins could work at the same time - this is not a problem for me.

However it will be better to allow to redefine only part of wp_new_user_notification() function - either one which sends email to new user, or to admin. Therefore I ask to split this function into two new ones. Attached patch does this.

Attachments (4)

pluggable.php.diff (2.4 KB) - added by sirzooro 4 years ago.
11210_pluggable.php.adds-hooks.patch (2.6 KB) - added by nacin 4 years ago.
Quick attempt to add hooks to wp_new_user_notification
11210.diff (2.4 KB) - added by Denis-de-Bernardy 3 months ago.
introduce two hooks similar to the one suggested in #25762 - 25762.11.diff
11210.2.diff (2.4 KB) - added by Denis-de-Bernardy 3 months ago.
The same with WP coding standards

Download all attachments as: .zip

Change History (18)

sirzooro4 years ago

comment:1 nacin4 years ago

Why not just add some hooks instead? That function has none currently.

nacin4 years ago

Quick attempt to add hooks to wp_new_user_notification

comment:2 nacin4 years ago

After going through and adding the hooks, your way seems like a better idea. Figured I'd try it and share anyway.

comment:3 westi4 years ago

  • Milestone changed from 2.9 to 3.0

Postponing for now.

comment:4 mattrude4 years ago

  • Cc m@… added

comment:5 hakre4 years ago

I think both Ideas should be combined: split and hooks.

comment:6 Denis-de-Bernardy4 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 3.0 to Future Release

combining both ideas gets my vote too.

comment:7 jfarthing844 years ago

I like the idea by @nacin. It needs some adjustments, but why introduce new functions when the old one can handle it just fine? I need this same functionality as @sirzooro for my plugin "Theme My Login" as well.

See #12184

comment:8 jfarthing844 years ago

  • Cc jeff@… added

comment:9 beaulebens4 years ago

  • Cc beau@… added

Any movement on this one? Seems like it'd be a good one to have, especially with people building more and more customized network/multi-site installs. Consider me a +1 to the combined approach as well.

comment:10 nacin3 months ago

  • Component changed from Plugins to Login and Registration

We're done with adding pluggable functions to WordPress. If we are to do this, it should be moving all of these bits out of the pluggable functions, creating two functions that contain proper hooks, and then having the current pluggable function call these new functions. Even better, we should then move that function to pluggable-deprecated.php and use the two new functions wherever we used the old one.

comment:12 ircbot3 months ago

This ticket was mentioned in IRC in #wordpress-dev by ddebernardy. View the logs.

Denis-de-Bernardy3 months ago

introduce two hooks similar to the one suggested in #25762 - 25762.11.diff

comment:13 Denis-de-Bernardy3 months ago

  • Keywords has-patch added; needs-patch removed

Denis-de-Bernardy3 months ago

The same with WP coding standards

comment:14 jdgrimes8 days ago

Has it been decided not to split this into two functions? I agree with nacin's comment, I think it would be better to split it.

Note: See TracTickets for help on using tickets.