Move new user notification emails to add_action() callbacks.
When a new user is created in various places throughout the interface, notifications are sent to the site admin and the new user. Previously, these notifications were fired through direct calls to `wp_new_user_notification()`, making it difficult to stop or modify the messages. This changeset introduces a number of new action hooks in place of direct calls to `wp_new_user_notification()`, and hooks the new wrapper function `wp_send_new_user_notifications()` to these hooks. Props dshanske, thomaswm, boonebgorges. Fixes #33587. Built from https://develop.svn.wordpress.org/trunk@34251 git-svn-id: http://core.svn.wordpress.org/trunk@34215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2023,11 +2023,31 @@ function register_new_user( $user_login, $user_email ) {
|
||||
|
||||
update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
|
||||
|
||||
wp_new_user_notification( $user_id, null, 'both' );
|
||||
/**
|
||||
* Fires after a new user registration has been recorded.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param int $user_id ID of the newly registered user.
|
||||
*/
|
||||
do_action( 'register_new_user', $user_id );
|
||||
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate email notifications related to the creation of new users.
|
||||
*
|
||||
* Notifications are sent both to the site admin and to the newly created user.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param int $user_id ID of the newly created user.
|
||||
*/
|
||||
function wp_send_new_user_notifications( $user_id ) {
|
||||
wp_new_user_notification( $user_id, null, 'both' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the current session token from the logged_in cookie.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user