Opened 15 years ago
Closed 8 years ago
#11210 closed enhancement (duplicate)
Split wp_new_user_notification() into two functions
Reported by: | sirzooro | Owned by: | 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)
Change History (23)
#2
@
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.
#6
@
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
@
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
#9
@
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
@
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
#14
@
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.
#15
@
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. This is actually why I added the filters to disable them instead.
Why not just add some hooks instead? That function has none currently.