WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 2 months ago

Last modified 2 months ago

#52605 closed defect (bug) (fixed)

Reset password email sent in wrong language

Reported by: Chouby Owned by: desrosj
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.7
Component: Users Keywords: needs-unit-tests has-patch commit dev-reviewed
Focuses: Cc:

Description

Testing the new WP 5.7 feature allowing admin to send a reset password link to users. https://make.wordpress.org/core/2021/02/22/send-reset-password-links-in-wordpress-5-7/ in 5.7-beta3-50398.

On a fresh WordPress site,

  1. Select Spanish as website language.
  2. Assign French as language for the administrator.
  3. Create a subscriber and select German for his/her language.
  4. As admin, click on "Send password reset" (not yet translated) for the German subscriber in the users list.

The email is sent in French (the language of the administrator).
I expect it to be sent in German.

If I assign the default site language to the German user, the email is still sent in French. I expect it to be sent in Spanish.

Attachments (2)

52605.diff (1.1 KB) - added by davidbaumwald 3 months ago.
Quick first pass
52605.2.diff (1004 bytes) - added by Chouby 2 months ago.

Download all attachments as: .zip

Change History (15)

#1 @johnbillion
3 months ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 5.7

Moving to 5.7 to see if we can get a switch_to_locale() in there in time.

@davidbaumwald
3 months ago

Quick first pass

#2 @audrasjb
3 months ago

  • Keywords has-patch added; needs-patch removed

Thanks @davidbaumwald, I tested your patch and it looks good to me.

Testing instructions I followed:

  • Set up your website to English
  • Changes its locale to French
  • Set the website back to English
  • Create a new user
  • Set their locale to French
  • Send a password reset link to the user: the email is in English. It should be in French (user's Locale)
  • Apply the patch proposed by @davidbaumwald
  • Send a password reset link to the user: the email is in French, merveilleux 🍷

#4 @desrosj
2 months ago

  • Owner set to desrosj
  • Status changed from new to reviewing

#5 @desrosj
2 months ago

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

In 50415:

Users: Ensure reset password emails are in the receiving user’s locale.

This ensures that reset password emails initiated by an administrator are sent to the user in their preferred locale.

Follow up to [50129,50139-50141,50152].

Props chouby, davidbaumwald, audrasjb, johnbillion.
Fixes #52605. See #34281.

@Chouby
2 months ago

#6 @Chouby
2 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

May I suggest 52605.2.diff as an improvement?

The reason for my proposal to move the switch_to_locale() above the evaluation of the site name is to allow Polylang to translate the site name on the fly when retrieving the blogname option.

#7 @peterwilsoncc
2 months ago

Thanks @Chouby, this makes sense to me and I am sure will prove useful for other plugins for multilingual sites.

#8 @peterwilsoncc
2 months ago

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

In 50439:

Users: Use localized site title for password reset emails.

When sending password reset emails, switch to the user's locale prior to obtaining the site title to allow for plugins filtering based on locale.

Follow up to [50129,50139-50141,50152,50415].

Props chouby.
Fixes #52605. See #34281.

#9 @peterwilsoncc
2 months ago

  • Keywords dev-feedback fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for [50439] to be back-ported to the 5.7 branch after a second committer reviews.

#10 @SergeyBiryukov
2 months ago

  • Keywords commit dev-reviewed added; dev-feedback fixed-major removed

[50439] looks good to backport.

#11 @SergeyBiryukov
2 months ago

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

In 50440:

Users: Use localized site title for password reset emails.

When sending password reset emails, switch to the user's locale prior to obtaining the site title to allow for plugins filtering based on locale.

Follow up to [50129,50139-50141,50152,50415].

Props chouby.
Merges [50439] to the 5.7 branch.
Fixes #52605. See #34281.

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


2 months ago

#13 @apedog
2 months ago

related #49971 - Admin locale setting that is independent of front/site locale and user locale.

Note: See TracTickets for help on using tickets.