Make WordPress Core

Opened 15 years ago

Closed 8 years ago

#11210 closed enhancement (duplicate)

Split wp_new_user_notification() into two functions

Reported by: sirzooro's profile sirzooro Owned by: westi's profile westi
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: Login and Registration Keywords: has-patch dev-feedback close
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 (5)

pluggable.php.diff (2.4 KB) - added by sirzooro 15 years ago.
11210_pluggable.php.adds-hooks.patch (2.6 KB) - added by nacin 15 years ago.
Quick attempt to add hooks to wp_new_user_notification
11210.diff (2.4 KB) - added by Denis-de-Bernardy 11 years 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 11 years ago.
The same with WP coding standards
11210.patch (5.9 KB) - added by jfarthing84 9 years ago.
Split wp_new_user_notification into two functions.

Download all attachments as: .zip

Change History (23)

#1 @nacin
15 years ago

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

@nacin
15 years ago

Quick attempt to add hooks to wp_new_user_notification

#2 @nacin
15 years ago

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

#3 @westi
15 years ago

  • Milestone changed from 2.9 to 3.0

Postponing for now.

#4 @mattrude
15 years ago

  • Cc m@… added

#5 @hakre
15 years ago

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

#6 @Denis-de-Bernardy
15 years ago

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

combining both ideas gets my vote too.

#7 @jfarthing84
15 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

#8 @jfarthing84
15 years ago

  • Cc jeff@… added

#9 @beaulebens
14 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.

#10 @nacin
11 years 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.

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


11 years ago

@Denis-de-Bernardy
11 years ago

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

#13 @Denis-de-Bernardy
11 years ago

  • Keywords has-patch added; needs-patch removed

@Denis-de-Bernardy
11 years ago

The same with WP coding standards

#14 @jdgrimes
11 years 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.

@jfarthing84
9 years ago

Split wp_new_user_notification into two functions.

#15 @jfarthing84
9 years ago

  • Keywords dev-feedback added

My patch creates two new functions: wp_new_user_registration_notification() and wp_new_user_registration_admin_notification(). The current wp_new_user_notification() simply becomes a wrapper function for these two functions. Additionally, I added filters to both functions: one to add the possibility to disable the notification, one to modify the e-mail subject and one to modify the e-mail message.

Ideally, I'd like to see the wp_new_user_notification() call within register_new_user() be replaced with an action, such as new_user_registered, and then the two new functions hooked to it as default actions, rendering wp_new_user_notification() deprecated. However, I know wp_new_user_notification() is used in other places, hence why I didn't propose this route in my patch.

Version 0, edited 9 years ago by jfarthing84 (next)

#17 @jfarthing84
8 years ago

  • Keywords close added

I would argue that this is resolved with [34251]. The function wasn't split in two, but it's pretty trivial to only send one or the other now.

Last edited 8 years ago by jfarthing84 (previous) (diff)

#18 @johnbillion
8 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #33587.

Note: See TracTickets for help on using tickets.