Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#34377 closed defect (bug) (fixed)

Another unexpected break in behavior for wp_new_user_notification()

Reported by: danielbachhuber's profile danielbachhuber Owned by: ocean90's profile ocean90
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch
Focuses: Cc:

Description

wp_new_user_notification() originally sent two emails if $password was provided: one to the admin, and another to the created user.

r33620 "restored" this behavior, but then r34116 disabled this behavior because the deprecated $password argument isn't checked in this conditional:

 if ( 'admin' === $notify || empty( $notify ) ) {
    return;
}

If $password is provided, I'd expect the conditional to fail.

I think that $notify could default to 'both', in which case empty( $notify ) could just be removed.

Discovered in https://github.com/wp-cli/wp-cli/pull/2163

Attachments (1)

34377.1.diff (3.5 KB) - added by danielbachhuber 9 years ago.

Download all attachments as: .zip

Change History (6)

This ticket was mentioned in Slack in #core by danielbachhuber. View the logs.


9 years ago

This ticket was mentioned in Slack in #core by helen. View the logs.


9 years ago

#3 @helen
9 years ago

  • Owner set to ocean90
  • Status changed from new to assigned

#4 @ocean90
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 35735:

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.

#5 @helen
9 years ago

  • Milestone changed from 4.3.2 to 4.4

This close to 4.4, no hint of 4.3.2 in sight.

Note: See TracTickets for help on using tickets.