Make WordPress Core

11/24/2015 11:06:03 PM (6 years ago)

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.

1 edited


  • trunk/src/wp-includes/pluggable.php

    r35415 r35735  
    14591459    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    14601460    $comment_content = wp_specialchars_decode( $comment->comment_content );
    14621462    switch ( $comment->comment_type ) {
    14631463        case 'trackback':
    17381738 * @param null   $deprecated Not used (argument deprecated).
    17391739 * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
    1740  *                           string (admin only), or 'both' (admin and user). The empty string value was kept
    1741  *                           for backward-compatibility purposes with the renamed parameter. Default empty.
     1740 *                           string (admin only), or 'both' (admin and user). Default empty.
    17421741 */
    17431742function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
    17591758    @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
    1761     if ( 'admin' === $notify || empty( $notify ) ) {
     1760    // `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
     1761    if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
    17621762        return;
    17631763    }
Note: See TracChangeset for help on using the changeset viewer.