friendica/friendica — pull request #574 by fermionic (2013-01-03 18:46:17+00:00)
Title: Finalize theme decision in a module's _init function

In a couple of places, profile_load() was called in the _content function of a module (display and profiles). The result was that there was the possibility of the theme changing after the former theme's _init function was called, and the new theme's _init function would never be called. By calling profile_load() only from a module's _init() function, the theme should always be finalized before theme-specific content is loaded.

Additionally, I moved all the initialization content in the various theme.php files to the theme's _init() function. This allows the loading of the content to be controlled, instead of just happening in an uncontrolled way when the theme.php file is loaded.

This fix is being submitted in place of overhauling the theme system. I still like the idea of overhauling, but it's tedious to implement and there were some changes to plugins and program flow that I wasn't sure would be acceptable, so it's on hold for now.