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.

git-svn-id: https://develop.svn.wordpress.org/trunk@34251 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-09-16 22:18:33 +00:00
parent d26b868870
commit de7c9b6015
7 changed files with 61 additions and 7 deletions

View File

@@ -176,7 +176,14 @@ function edit_user( $user_id = 0 ) {
$user_id = wp_update_user( $user );
} else {
$user_id = wp_insert_user( $user );
wp_new_user_notification( $user_id, null, 'both' );
/**
* Fires after a new user has been created.
*
* @since 4.4.0
*
* @param int $user_id ID of the newly created user.
*/
do_action( 'edit_user_created_user', $user_id );
}
return $user_id;
}