MyBB Community Forums

Full Version: Modification of timezones/DST setting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As it seems, both timezone and DST setting are set per user, so the settings in the Admin CP are just for unregistered users, am I right?

I cant see no reason why any user has to correct his DST setting by himself, when I corrected it globally already.

I think there should be a new "Default" option for the timezone option, as we already have it for date- and time format which simply clears the field in the database.

I achieved this for me by editing inc/functions.php:
PHP Code:
        if($mybb->user['uid'] != && array_key_exists("timezone"$mybb->user))
        {
            if (!empty(
$mybb->user['timezone']))  {
                
$offset $mybb->user['timezone'];
                
$dstcorrection $mybb->user['dst'];
            } else {
                
$offset $mybb->settings['timezoneoffset'];    
                
$dstcorrection $mybb->settings['dstcorrection'];
            }
        } 
This way all users that have their own timezone set will get it, anyone else will get the global standard.

What is missing now is the default option in the User-CP and the registration.
DST changes at different times depending on where you live so it wouldn't really work for those living in a different time zone too.
Chris Boulton Wrote:DST changes at different times depending on where you live so it wouldn't really work for those living in a different time zone too.
Yes, I know, that's why my code first of all checks whether a user has a personal timezone set.
If not, his timezone and DST will be overwritten by the server's settings.

For example if you have a german board, most users will come from a german-speaking region such as Germany, Austria or Switzerland.
Having in mind that most of the users live in the same timezone, why not introduce a "Default Timezone" setting, which will always reflect the global settings.

If someone lives in another timezone, he'll simply select it and then the global settings won't have an influence on his timezone/DST.

I hope you understood Wink
It's more complex than that, if you want a proper solution. You need to also take into account contries/states that don't have DST, like Arizona.
Yet another reason to store the name of the timezone and not just the offset and dst correction. I would much rather set my timezone to "America/Denver" (or "America/Mountain") and let the operating system take care of the dst than set the offset to +7 and change dst twice a year.
MyBB 1.4 will automatically change the DST setting using javascript - assuming the local time zone matches that configured in the users profile.
Reference URL's