Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Pyrhel on February 12, 2022, 12:14:55 PM

Title: Reset users timezones
Post by: Pyrhel on February 12, 2022, 12:14:55 PM
I saw in the admin page I can disable customizing timezone by the users and to set a default one. But is there a way to reset already set timezones?
Title: Re: Reset users timezones
Post by: Pyrhel on February 14, 2022, 03:21:06 AM
I did it by updating the DB:
update smf_users set timezone = 'prefered timezone here'
Title: Re: Reset users timezones
Post by: shawnb61 on February 14, 2022, 12:26:18 PM
There has got to be a better way...  Submitted an enhancement request:
https://github.com/SimpleMachines/SMF2.1/issues/7324
Title: Re: Reset users timezones
Post by: jsx on April 21, 2022, 06:01:03 AM
Quote from: Pyrhel on February 12, 2022, 12:14:55 PMI saw in the admin page I can disable customizing timezone by the users and to set a default one.

Where exactly in the admin panel can I find this function?
Title: Re: Reset users timezones
Post by: Doug Heffernan on April 21, 2022, 06:05:33 AM
Quote from: jsx on April 21, 2022, 06:01:03 AMWhere exactly in the admin panel can I find this function?

You can set a default time zone by going to Configuration->Features and Options->Forum default timezone.
Title: Re: Reset users timezones
Post by: jsx on April 21, 2022, 07:28:21 AM
A user on the Polish SMF 2.1 support forum wrote that he updated the forum from SMF 2.0.x to 2.1 and set the correct timezone in Forum default timezone, but all users have the default time zone set to: UTC Coordinated Universal Time - the correct time is not displayed in these users on the forum. So if I understand it correctly will it be fixed in SMF 2.1.2?

https://github.com/SimpleMachines/SMF2.1/issues/7324
Title: Re: Reset users timezones
Post by: shawnb61 on April 21, 2022, 09:27:51 AM
Yes. There may be a need to reset the user timezones manually. 
Title: Re: Reset users timezones
Post by: jsx on April 21, 2022, 02:08:20 PM
I downloaded the package from github and installed SMF 2.1.2 and I have the correct time zone set in the admin panel and in my account settings. SMF 2.1.2 automatically detects forum time zone?

Title: Re: Reset users timezones
Post by: Sesquipedalian on April 21, 2022, 02:18:54 PM
Quote from: jsx on April 21, 2022, 02:08:20 PMSMF 2.1.2 automatically detects forum time zone?

If no default time zone has been selected yet in SMF's own settings, it falls back to whatever PHP is using for its default time zone. PHP in turn might have a specific default time zone selected in its settings, or it might fall back to whatever time zone the server's operating system is using.
Title: Re: Reset users timezones
Post by: jsx on April 21, 2022, 02:27:53 PM
@Sesquipedalian thank you for the clarification.

Quote from: shawnb61 on April 21, 2022, 09:27:51 AMThere may be a need to reset the user timezones manually.

If someone updated the forum from 2.0.x to 2.1.1 now someone have to manually reset the timezone for all users? How to do it?

Title: Re: Reset users timezones
Post by: @rjen on April 21, 2022, 02:33:30 PM
With an sql statement directly in the database ...
Title: Re: Reset users timezones
Post by: Sesquipedalian on April 21, 2022, 02:36:07 PM
FYI, this is incorrect:

Quote from: Pyrhel on February 12, 2022, 12:14:55 PMI saw in the admin page I can disable customizing timezone by the users

Setting the default time zone for the forum does not prevent individual members from choosing a different time zone.
Title: Re: Reset users timezones
Post by: jsx on April 21, 2022, 04:24:04 PM
For the test I changed the time zone for a few users. And then in phpMyAdmin in the database in the SQL tab I entered this command:

UPDATE `smf_members` SET `timezone` = 'Europe/Warsaw'
The time zone has changed to the correct time zone for all users.

List of Supported Timezones

https://www.php.net/manual/en/timezones.php
Title: Re: Reset users timezones
Post by: Sesquipedalian on April 21, 2022, 05:10:02 PM
If you want to do this, I would recommend just this:

UPDATE `smf_members` SET `timezone` = ''
...and then setting the forum's default time zone to Europe/Warsaw.
Title: Re: Reset users timezones
Post by: jsx on April 22, 2022, 05:44:28 AM
Thanks for the tip. :)