#30 - Sticky Template Chooser (or allowing your users to choose their own Joomla template)
The Template Chooser, is one frustrating module. The first time you see it, you think that it's there to allow your users to choose their own templates. You enable it and leave it there, but you realise that it actually reverts to the default template.
With this small hack, you can ensure that the Joomla template your users choose via the Template Chooser, remains there always (or at least as long as the cookie lasts )
Find the following lines in includes/joomla.php. There's a cookie setting for the tempalte which lasts only 10 minutes. To extend it, reset the time to your choosing.
In Joomla 1.0.13 see lines 1288-1295:
// check that template exists in case it was deleted
if (file_exists( $mosConfig_absolute_path .'/templates/'. $jos_change_template .'/index.php' )) {
$lifetime = 60*60*24*365; // *dr* change it from 60x10 (=10 minutes) to
60*60*24*365 (=365 days) to save template choice for 365 days;
$cur_template = $jos_change_template;
setcookie( 'jos_user_template', "$jos_change_template", time()+$lifetime);
} else {
setcookie( 'jos_user_template', '', time()-3600 );
}
That's it ... your user choosable template now lasts for a year.
|