Skip to content

Confirmation page for export user data now on user language - #15717

Open
sawfly wants to merge 1 commit into
WordPress:trunkfrom
sawfly:44550-User-lang-for-export-confirmation-page
Open

sawfly wants to merge 1 commit into
WordPress:trunkfrom
sawfly:44550-User-lang-for-export-confirmation-page

Conversation

@sawfly

@sawfly sawfly commented Nov 6, 2026

Copy link
Copy Markdown

Description

When a registered user has selected a locale on their profile, the privacy request confirmation email is sent in that locale (#43985), but the "User action confirmed" page they land on after clicking the link (wp-login.php?action=confirmaction) is shown in the site's locale.

This PR adds the user's selected locale to the confirmation URL as wp_lang. determine_locale() already uses wp_lang on wp-login.php, so the confirmation page now matches the email's language.

wp_lang is added only when the request belongs to a registered user who has explicitly chosen a locale, even if it's the same as the site's locale. That way the page keeps the user's language if the site locale changes later. Unregistered requesters and users on "Site Default" get the same URL as before and follow the site locale.

This refreshes 44550.3.diff against current trunk:

  • The wp-login.php change is dropped. The confirmaction handler no longer switches locales, and determine_locale() handles wp_lang itself.
  • The URL is built from $request->confirm_key (#44940).
  • Test assertions are updated to assertStringContainsString() / assertStringNotContainsString().

Trac ticket

Trac ticket: https://core.trac.wordpress.org/ticket/44550

Testing Instructions

  1. Install a second language (e.g. Deutsch) in Settings → General, keeping the site language as English.
  2. Set a test user's profile Language to Deutsch.
  3. Go to Tools → Export Personal Data, add a request for that user, and send the confirmation email.
  4. The link in the email should end with &wp_lang=de_DE. Open it in a logged-out window. The "User action confirmed" page should appear in German.
  5. Repeat with an unregistered email address and with a user whose language is "Site Default". Neither link should contain wp_lang, and the page should use the site language.

Unit tests: npm run test:php -- --filter wpSendUserRequest

Use of AI Tools

AI assistance: Yes
Tool(s): Claude (Anthropic)
Model(s): Opus 5.5
Used for: Patch refresh and test updates were drafted with AI and reviewed and tested locally by me. AI generated description to PR


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sawf1y.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant