WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 18 months ago

Last modified 18 months ago

#23358 closed defect (bug) (fixed)

Switch to a usermeta key for email confirmation in Multisite

Reported by: SergeyBiryukov Owned by: ocean90
Milestone: 4.5 Priority: normal
Severity: normal Version: 3.0
Component: Options, Meta APIs Keywords: has-patch 2nd-opinion
Focuses: multisite Cc:

Description

Background: #23146

In send_confirmation_on_profile_email(), an option is used to store the new email:
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/includes/ms.php#L238

A usermeta key should be used instead.

Attachments (6)

23358.dff (4.3 KB) - added by MikeHansenMe 4 years ago.
First pass at switching to user_meta
23358.diff (5.4 KB) - added by kovshenin 4 years ago.
23358.2.diff (5.4 KB) - added by jeremyfelt 4 years ago.
23358.3.diff (5.1 KB) - added by MikeHansenMe 2 years ago.
Refreshed
23358.4.diff (4.8 KB) - added by MikeHansenMe 23 months ago.
23358.5.diff (5.1 KB) - added by ocean90 18 months ago.

Download all attachments as: .zip

Change History (24)

#2 @SergeyBiryukov
4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.7

@MikeHansenMe
4 years ago

First pass at switching to user_meta

#3 @MikeHansenMe
4 years ago

  • Cc mdhansen@… added
  • Keywords has-patch needs-testing added; needs-patch removed

@kovshenin
4 years ago

#4 @kovshenin
4 years ago

Mike's patch works well. 23358.diff adds some back-compat code to make sure that initiated e-mail changes before an upgrade are not broken.

#5 @DrewAPicture
4 years ago

  • Cc xoodrew@… added

@jeremyfelt
4 years ago

#6 @jeremyfelt
4 years ago

  • Keywords needs-testing removed

23358.2.diff is a refresh against current trunk. Tested the move from *_option() to *_user_meta() and all appears to be working as intended at the DB level.

#7 @nacin
4 years ago

  • Milestone changed from 3.7 to Future Release

This has been like this for a long time. Rather than mess with this for now, let's do this earlier in a cycle.

#8 @jeremyfelt
4 years ago

  • Component changed from Multisite to Options and Meta
  • Focuses multisite added

@MikeHansenMe
2 years ago

Refreshed

#9 @chriscct7
23 months ago

  • Keywords early needs-refresh added

#10 @chriscct7
23 months ago

  • Keywords needs-refresh removed

This applied correctly for mike. I might have forgotten to remove changes at the bottom of user.php from an earlier patch.

#11 @ocean90
19 months ago

  • Milestone changed from Future Release to 4.5
  • Owner set to ocean90
  • Status changed from new to accepted

#12 @ocean90
19 months ago

What are your thoughts on an upgrade routine instead of _user_new_email_compat()? With SELECT * FROM {$wpdb->options} WHERE option_name REGEXP '[0-9]+_new_email'; we could fetch all existing options.

@ocean90
18 months ago

#13 @ocean90
18 months ago

  • Keywords 2nd-opinion added; early removed

Attached 23358.5.diff:

  • IMO we don't have to provide a compat layer for the switch to user meta. It's unlikely that users whose options are still in the database are still interested in changing their email.
  • But in case a user still wants to change their mail with an old key I've added an error message "Error while saving the new email. Please try again.".
  • Something for another ticket: Shouldn't the email change links expire like password reset links, see [33019]?

Thoughts?

This ticket was mentioned in Slack in #core-multisite by ocean90. View the logs.


18 months ago

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


18 months ago

#16 @ocean90
18 months ago

  • Type changed from enhancement to defect (bug)

Changing to bug because this leaves to inconsistent data across sites: site A shows the message and the new mail while site B shows no such message.

#17 @ocean90
18 months ago

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

In 36679:

Multisite: Switch to a usermeta key for email confirmation.

To prevent inconsistent data across sites in a network the new email address is now stored in usermeta. Adds visual feedback for the case when an update has failed.
All existing options will be removed on a database upgrade.

Props MikeHansenMe, kovshenin, jeremyfelt, ocean90.
Fixes #23358.

#18 @ocean90
18 months ago

In 36686:

Upgrade: Bump db version for upgrade_450() in upgrade_all().

See #23358.

Note: See TracTickets for help on using tickets.