ClientConfig not returning correct context settings


(Josh Curtis) #1

I’ve updated ClientConfig to 2.0 and enabled multi-context settings in the system settings.

I can input settings and everything is saving correctly, but I’m always getting the ‘web’ settings even though I’m loading pages from other contexts.

I’m using XRouting which I notice fires on OnHandleRequest while ClientConfig fires on OnMODXInit - can anyone confirm they have this working with XRouting and/or whether or not OnHandleRequest should be firing ahead of OnMODXInit to give it what it needs since it seems to be getting the hard coded default ‘web’ context at the moment?


(Mark Hamstra) #2

OnMODXInit fires before OnHandleRequest.

Why that was changed in ClientConfig is discussed here:

Sounds like xRouting (and maybe others) need to be updated to use OnMODXInit.

Related: https://github.com/modmore/ClientConfig/issues/140


(Josh Curtis) #3

Thanks for that history/update - interesting to know it’s needed for Babel.

I moved XRouting to OnMODXInit and that worked beautifully. Until I needed front end login via Login.

Sessions weren’t starting and moving both XRouting back to OnHandleRequest fixed that which has necessitated moving CientConfig back to OnHandleRequest too. It doesn’t make sense on the surface if moving to OnMODXInit moves the execution of those things a little bit earlier, but my observations say it matters.

Further research will be required to understand why it matters - Login doesn’t seem to have any plugin to run against an event so I’ll need to spend time digging through the Login code to learn more.


(Mark Hamstra) #4

Maybe you disabled sessions on some contexts, and that is getting confused with the way contexts are switched with the new event?


(Josh Curtis) #5

There are two contexts (other than manager) and neither have a session_enabled setting - is that what you mean?


(Mark Hamstra) #6

Yeah that was what I was thinking. Honestly, I just can’t think of a reason why a different event for routing would have any effect on sessions/logging in…