Under 6.13, when I set "Display mode: Random logos" and the Random frequency to something other than every page refresh ie using a time interval the random logo only works once at the start of each interval.
What happens is the logotool code sets the logo in $variables the first time in the time interval and the logo displays. The next time a page is requested within the interval the logo is not set (it thinks it doesn't have to) and no logo displays, or the site/theme logo displays if it is set in the theme or site settings.
The reason for this is that the includes/theme.inc sets the logo variable in $variables to the site default and logotools doesn't override this within the interval (only the first time).
The problem is in this bit of the code:
case '1':
if ($time || !variable_get('logotool_frequency', 0)) {
$logos = logotool_scan_dir(variable_get('logotool_folder', LT_CWD));
if ($time) {
variable_set('logotool_timestamp', time());
}
$variables['logo'] = sprintf("/%s", array_rand($logos));
}
break;
so if we're within the interval and we don't need to set the next timestamp $variables['logo'] is never set and the theme value is retained.
I'd fix it if I knew how to set a variable that persists but I'm unsure how to do that in the Drupal setting.
Comments
Comment #1
Anonymous (not verified) commentedI've cobbled together a fix for this:
Around line 385 of logotool.module:
This uses a persistent variable to save the random logo for use in subsequent page refreshes. I'm no drupal programmer but this certainly seems to work for me.
Comment #2
pobster commentedThanks, I'll look into this. TBH the reason the 6.x release is still in dev is because I haven't had time to test it at all outside of what I need it to do myself.
Pobster
Comment #3
Anonymous (not verified) commentedThanks pobster - I'm happy to test any tweaks you make as yours is the only solution I can find for random but time based logos.
For now I'm ok with the fix I made. Thanks for the module.
Comment #4
pobster commentedLooks fine now for the 2.x release.
Pobster