mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Passwords: Restore second parameter for wp_new_user_notification().
After [33023] users would always be notified, this restores previous behavior. Props markjaquith, ocean90. Fixes #33358. git-svn-id: https://develop.svn.wordpress.org/trunk@33620 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1688,10 +1688,13 @@ if ( !function_exists('wp_new_user_notification') ) :
|
||||
* A new user registration notification is also sent to admin email.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
|
||||
*
|
||||
* @param int $user_id User ID.
|
||||
* @param int $user_id User ID.
|
||||
* @param string $notify Whether admin and user should be notified ('both') or
|
||||
* only the admin ('admin' or empty).
|
||||
*/
|
||||
function wp_new_user_notification($user_id) {
|
||||
function wp_new_user_notification( $user_id, $notify = '' ) {
|
||||
global $wpdb;
|
||||
$user = get_userdata( $user_id );
|
||||
|
||||
@@ -1705,9 +1708,14 @@ function wp_new_user_notification($user_id) {
|
||||
|
||||
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
|
||||
|
||||
if ( 'admin' === $notify || empty( $notify ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate something random for a password reset key.
|
||||
$key = wp_generate_password( 20, false );
|
||||
|
||||
/** This action is documented in wp-login.php */
|
||||
do_action( 'retrieve_password_key', $user->user_login, $key );
|
||||
|
||||
// Now insert the key, hashed, into the DB.
|
||||
@@ -1725,7 +1733,6 @@ function wp_new_user_notification($user_id) {
|
||||
$message .= wp_login_url() . "\r\n";
|
||||
|
||||
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user