Blog Sections Open
Using Login Across Two Different Contexts in MODX Revo
If one request initializes only one Revo context, you need to be deliberate about how shared login behavior is configured across the contexts.
A frequent Revo question in multisite or multi-context projects is how to make one login flow work across two contexts such as web and web2.
The Common Misunderstanding
Developers often expect this to work automatically just because both contexts live in the same installation. But when the request is initialized like this:
$modx->initialize('web');
the request is operating inside web. A separate context such as web2 is not magically part of the same runtime rules unless the authentication and session strategy is designed that way.
What to Review
- whether both contexts should share the same user session
- whether the Login extra is configured with the needed
&contextslist - whether permissions and user groups are valid in both contexts
- whether cookies and session settings are consistent for the whole domain
The Key Practical Rule
Do not think of this as “initialize two contexts in one page and everything works”. Think of it as a shared authentication design. The login component must know which contexts it should authorize, and the site must be using a cookie/session configuration that lets that access survive between requests.
When Things Go Wrong
If login works in one context but not the other, the issue is usually one of three things: context access settings, context-specific permissions, or cookies/session scope. Debug those before rewriting the login form itself.
Rendering MultiTV Table Data Cleanly on the Frontend
A practical note on handling MultiTV output when a table-style data structure mixes text, rich text, URLs, and thumbnails.
Creating Documents Programmatically with TV Values in MODX Revo
How to create a resource through the MODX Revo API and then assign TV values correctly after the resource has been saved.