From 0632e4ab84e6ed90ddff2935f51238dda88a22dd Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Tue, 24 Nov 2015 23:07:26 +0000 Subject: [PATCH] Passwords: Support the pre-4.3 behavior of `wp_new_user_notification()`. Hello, it's me again. A pluggable function named `wp_new_user_notification()`. A few months ago, after [33023], I have lost my second parameter `$plaintext_pass`. But thanks to [33620] I got a new one. Bad idea - It hasn't had the same behavior as my previous parameter. To solve that the second parameter got deprecated and reintroduced as the third parameter in [34116]. I was happy again, for a short time. You remember my lost friend `$plaintext_pass`? No? Well, if its value was empty no notification was sent to the user. This behavior was still lost. And that's what this change is about: Don't notify a user if a plugin uses `wp_new_user_notification( $user_id )`. You're asking if I'm happy now? Dunno, but maybe you have learned something about pluggable functions, have you? Props danielbachhuber. Fixes #34377. Built from https://develop.svn.wordpress.org/trunk@35735 git-svn-id: http://core.svn.wordpress.org/trunk@35699 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 8 ++++---- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index ecacab460e..88d1440599 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1458,7 +1458,7 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) { // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $comment_content = wp_specialchars_decode( $comment->comment_content ); - + switch ( $comment->comment_type ) { case 'trackback': $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; @@ -1737,8 +1737,7 @@ if ( !function_exists('wp_new_user_notification') ) : * @param int $user_id User ID. * @param null $deprecated Not used (argument deprecated). * @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty - * string (admin only), or 'both' (admin and user). The empty string value was kept - * for backward-compatibility purposes with the renamed parameter. Default empty. + * string (admin only), or 'both' (admin and user). Default empty. */ function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) { if ( $deprecated !== null ) { @@ -1758,7 +1757,8 @@ function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); - if ( 'admin' === $notify || empty( $notify ) ) { + // `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation. + if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) { return; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 29fd81f140..1a70f6e586 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-beta4-35734'; +$wp_version = '4.4-beta4-35735'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.