WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#32684 closed defect (bug) (fixed)

wp_update_user() is the 'user_email' now a required $userdata arg for updating a user ?

Reported by: imath Owned by: boonebgorges
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.3
Component: Users Keywords:
Focuses: Cc:

Description

in r32820 there's a new check on $userdata['user_email'] to see if an email should be send if i understand well.

My problem is: if i want to update the display name, doing something like this :

// Update the display_name
wp_update_user( array(
	'ID'                  => $user_id,
	'display_name' => $display_name,
) );

Then i get an error because $userdata['user_email'] is not set in my array.

If the user_email is now required, then simply close this ticket.

imho maybe an isset( $userdata['user_mail'] ) before comparing it to $useruser_email? would be nice, because i might not be the only one using wp_update_user() the way i've described above.

Attachments (1)

32684.patch (537 bytes) - added by imath 3 years ago.

Download all attachments as: .zip

Change History (4)

@imath
3 years ago

#1 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 4.3

#2 @boonebgorges
3 years ago

Confirmed. This change is also breaking a lot of unit tests.

#3 @boonebgorges
3 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 32838:

When updating a user, only send email-change notification if email address is passed.

The notification, introduced in [32380], was firing incorrectly (and throwing
a PHP notice) when wp_update_user() was called without including 'user_email'
in the update data.

Props imath.
Fixes #32684. See #32430.

Note: See TracTickets for help on using tickets.