Skip to content

docs(events): Clarify OnWebLogin vs getUser() on web login - #586

Open
Ibochkarev wants to merge 1 commit into
modxorg:3.xfrom
Ibochkarev:docs/issue-428-onweblogin-getuser
Open

docs(events): Clarify OnWebLogin vs getUser() on web login#586
Ibochkarev wants to merge 1 commit into
modxorg:3.xfrom
Ibochkarev:docs/issue-428-onweblogin-getuser

Conversation

@Ibochkarev

Copy link
Copy Markdown
Collaborator

Description

Docs claimed the user is fully “logged in” during OnWebLogin, which led people to call $modx->getUser() and get the previous (often anonymous) user.

On Revolution 3.x, Login::afterLogin() adds session contexts, then for mgr only resets $modx->user and calls getUser('mgr', true) before OnManagerLogin. For web it invokes OnWebLogin without that refresh, so $modx->getUser() still returns the request-cached user.

Updates en/ru OnWebLogin pages: correct attributes shape from fireAfterLoginEvent(), document the getUser() caveat, and show using the event $user (or an explicit reload).

Affected versions

Both (same Login processor pattern on 2.x/3.x; verified against Revolution 3.x Processors/Security/Login.php)

Relevant issues

Fixes #428

@Ibochkarev
Ibochkarev marked this pull request as ready for review August 15, 2026 04:19
@Ibochkarev
Ibochkarev requested a review from Mark-H August 15, 2026 04:19
@Mark-H

Mark-H commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Is this something we should fix in core? Documenting the edge case still makes sense but it seems like #428 warrants looking into the core.

Document that session contexts exist before OnWebLogin but $modx->user
is not refreshed for web contexts. Point plugins at the $user event
parameter. Align attributes with Login::fireAfterLoginEvent on 3.x.
@cursor
cursor Bot force-pushed the docs/issue-428-onweblogin-getuser branch from 62cc3ed to ea6c795 Compare August 15, 2026 11:07
@Ibochkarev

Copy link
Copy Markdown
Collaborator Author

Is this something we should fix in core? Documenting the edge case still makes sense but it seems like #428 warrants looking into the core.

Hi! Is it possible to transfer this issue to the modx repository?

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.

Issue on extending-modx/plugins/system-events/onweblogin

2 participants