Skip to content

fix(manager): persist manager language across logout/login - #16928

Open
Ibochkarev wants to merge 4 commits into
modxcms:3.xfrom
Ibochkarev:fix/16072-manager-language-persist
Open

Ibochkarev wants to merge 4 commits into
modxcms:3.xfrom
Ibochkarev:fix/16072-manager-language-persist

Conversation

@Ibochkarev

@Ibochkarev Ibochkarev commented Mar 16, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Manager language lived only in $_SESSION. Logout destroyed the session, so the locale reset on the next login (#16072).

This PR persists the choice in cookie modx_manager_language, reads it on login, sets it on language change, and passes manager_language through the logout redirect (PHP + modx.js). Adds modX::setManagerLanguageCookie().

How to test

  1. Log in, switch language (e.g. German).
  2. Log out, log in again.
  3. Confirm the manager stays on the chosen language.

Related issue(s)/PR(s)

Resolves #16072

Compatibility notes

Manager only. Cookie name modx_manager_language; value validated against available lexicons.

Breaking change assessment

No API signature changes. Additive persistence for manager locale. Safe for patch releases.

Test coverage

No automated tests added; manual login/logout flow.

Contributors

None beyond author.

AI tool use

Cursor helped normalize this PR description to the repository template.

@Ibochkarev
Ibochkarev marked this pull request as ready for review March 16, 2026 04:11
@smg6511 smg6511 self-assigned this May 9, 2026
Store manager language in cookie (modx_manager_language) so it survives
session end. Read cookie on login, set on language change and login.
Redirect to ?manager_language=XX after logout for immediate restore.

Fixes modxcms#16072
@Ibochkarev
Ibochkarev force-pushed the fix/16072-manager-language-persist branch from 6a01acd to 1f48536 Compare August 2, 2026 04:10
Fix operator spacing flagged by phpcs on touched modX.php lines.
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.00000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.78%. Comparing base (5a484de) to head (b294766).
⚠️ Report is 25 commits behind head on 3.x.

Files with missing lines Patch % Lines
core/src/Revolution/modX.php 32.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.x   #16928      +/-   ##
============================================
+ Coverage     21.67%   21.78%   +0.11%     
- Complexity    10786    10803      +17     
============================================
  Files           566      566              
  Lines         33149    33219      +70     
============================================
+ Hits           7186     7238      +52     
- Misses        25963    25981      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@smg6511 smg6511 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this definitely works. I have one change request and an optional suggestion for you to look at, then it's good to go.

Comment thread manager/assets/modext/core/modx.js Outdated
Comment thread manager/controllers/default/security/login.class.php Outdated
Ibochkarev and others added 2 commits September 21, 2026 09:08
Co-authored-by: Jim Graham <jim@pixelsandstrings.com>
Accept-Language detection varies too much across browsers to be a
reliable fallback. After request, cookie, and session, fall back to en.
@smg6511
smg6511 self-requested a review September 21, 2026 13:51

@smg6511 smg6511 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked and works well.

@Ibochkarev Ibochkarev added bug The issue in the code or project, which should be addressed. requires build Grunt build is required for integration type-frontend Issues related to UI/UX issues, mostly about styles and frontend implementations on JavaScript. labels Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug The issue in the code or project, which should be addressed. requires build Grunt build is required for integration type-frontend Issues related to UI/UX issues, mostly about styles and frontend implementations on JavaScript.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The selected language of the manager panel is reset after exiting the manager

2 participants