The theme variables are set in the Engine before code embedded in a node executes. I might play around with the theme changing code to see if I can regenerate $THEME in user settings.
I think it'll work, but there could be an order-of-operation bug. We'll see.
Update: My language is a bit imprecise. The real scoop is at EveryDevel (URL may be slightly off), with more than sufficient detail.
What happens, basically, is that the Engine receives a request, sets some global variables (including $THEME, which holds theme settings for the user), loads the requested node, loads the display page for the node, executes any code in the node (and there is code in the user settings node), generates the page, sends it to the browser, and updates the database with the new settings.
The code execution part changes the user setting that keeps track of which theme the user wants. It doesn't change $THEME accordingly. (In fact, it's probably already generated part of the page with the old theme).
I don't have any timezone code in the current codebase. I think vroom added that to Perlmonks on his own. |