Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#12184 closed enhancement (duplicate)

Move and add filters to wp_new_user_notification

Reported by: jfarthing84's profile jfarthing84 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: General Keywords: has-patch
Focuses: Cc:


I think that we should add actions and filters to the functions wp_new_user_notification() and while we're at it, wp_password_change_notification() instead of having them pluggable.php.

The reason I feel this way is because NUMEROUS plugins operate by overtaking the function wp_new_user_notification to add user settings and such when a user registers. However, as we know, only one of them can actually define this function, and that will naturally be the first plugin in alphabetical order.

So, why not make the function static by removing it from pluggable.php and adding it to, maybe wp-login.php, with all of the other login-related functions? Then we can add hooks and filters into the function in order to modify data and trigger events.

I have attached modified a diff with the functions removed from pluggable.php and added them to wp-login.php with the appropriate (I believe) actions and filters.

Let's get this change done so that many useful registration plugins that utilize this function can be used in conjunction with each other (once their respective authors update them, of course).

Attachments (1)

changes.diff (6.4 KB) - added by jfarthing84 14 years ago.
Modifications to wp-login.php and pluggable.php

Download all attachments as: .zip

Change History (11)

#1 @jfarthing84
14 years ago

  • Cc jeff@… added

#2 @jfarthing84
14 years ago

  • Keywords has-patch added

#3 @ryan
14 years ago

Sounds good although once moved into wp-login.php they will probably have to remain pluggable for back compat purposes. We can deprecate plugging and emphasize using the actions though. We might also need to add filters that allow short-circuiting of the functions.

#4 @jfarthing84
14 years ago

  • Keywords dev-feedback removed

OK. I am attaching a revised version with the functions kept as pluggable in wp-login.php, filters to short-circuit the functions and a few additional filters to modify the e-mails that are sent.

14 years ago

Modifications to wp-login.php and pluggable.php

#5 @ryan
14 years ago

Hmmm, wp_new_user_notification() is used in wp-admin/ms-edit.php and wp-admin/includes/user.php. wp_password_change_notification() is used only in wp-login.php. Looks like wp_new_user_notification() will have to stay in pluggable.php. We can still deprecate plugging it and encourage use of your new actions and filters.

#6 @jfarthing84
14 years ago

Or we could move wp_new_user_notification() to user.php.

#7 @ryan
14 years ago

I don't think we can maintain pluggability back compat if we put it in user.php. It'll be loaded before plugins are loaded.

#8 @nacin
14 years ago

Related: #11210.

#9 @jfarthing84
14 years ago

@ryan - You are right. I am suggesting to move it to user.php once it is decided it has been long enough to remove backward compatibility.

#10 @nacin
14 years ago

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

IMO better approaches in #11210.

Note: See TracTickets for help on using tickets.