Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set all users to the same timezone and stop them from changing it
#1
INTRODUCTION

When you edit the timezone settings in the Admin CP, it only affects guests and newly registered users. While registering, you can change your timezone settings. And after registering, you can also change your timezone settings in the User CP. In this tutorial, I will be teaching you how to set all users to the same timezone and disable them from editing it in the future.

TUTORIAL

1. Go to Admin CP > Configuration > Settings > Date and Time Formats.

2. Select your timezone from Default Timezone Offset and choose whether to enable DST or not from Day Light Savings Time.

3. Go to Admin CP > Templates & Style > Templates > Your Template Set > Member Templates > member_register.

4. Find and remove:

Code:
<fieldset class="trow2">
<legend><strong><label for="timezone">{$lang->time_offset}</label></strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}" width="100%">
<tr>
<td><span class="smalltext">{$lang->time_offset_desc}</span></td>
</tr>
<tr>
<td>{$tzselect}</td>
</tr>
<tr>
<td><span class="smalltext">{$lang->dst_correction}</span></td>
</tr>
<tr>
<td>
    <select name="dstcorrection">
        <option value="2" {$dst_auto_selected}>{$lang->dst_correction_auto}</option>
        <option value="1" {$dst_enabled_selected}>{$lang->dst_correction_enabled}</option>
        <option value="0" {$dst_disabled_selected}>{$lang->dst_correction_disabled}</option>
    </select>
</td>
</tr>
</table>
</fieldset>
<br />

5. Go to Admin CP > Templates & Style > Templates > Your Template Set > User Control Panel Templates > usercp_options.

6. Find and remove:

Code:
<tr>
<td><span class="smalltext">{$lang->time_offset_desc}</span></td>
</tr>
<tr>
<td>{$tzselect}</td>
</tr>
<tr>
<td><span class="smalltext">{$lang->dst_correction}</span></td>
</tr>
<tr>
<td>
    <select name="dstcorrection">
        <option value="2" {$dst_auto_selected}>{$lang->dst_correction_auto}</option>
        <option value="1" {$dst_enabled_selected}>{$lang->dst_correction_enabled}</option>
        <option value="0" {$dst_disabled_selected}>{$lang->dst_correction_disabled}</option>
    </select>
</td>
</tr>

7. If in step 2 you set Default Timezone Offset to a positive timezone (e.g. GMT +10:00), execute this SQL query (change the 10 to the actual timezone you want):

PHP Code:
UPDATE `mybb_usersSET `timezone` = '10' 

If in step 2 you set Default Timezone Offset to a negative timezone (e.g. GMT -10:00 Hours), execute this SQL query (change the -10 to the actual timezone you want):

PHP Code:
UPDATE `mybb_usersSET `timezone` = '-10' 

If in step 2 you set Default Timezone Offset to GMT, execute this SQL query:

PHP Code:
UPDATE `mybb_usersSET `timezone` = '0' 

8. In order to update all users to use the same setting that you set in Day Light Savings Time, execute this SQL query:

PHP Code:
UPDATE `mybb_usersSET `dstcorrection` = '2' 

CONCLUSION

If you followed these steps precisely, all users should have the same timezone and will not be able to change them in their User CP or during registration. See the examples below:

       
Reply
#2
Great work, Faviouz. Very nice, detailed and easy to follow tutorial. Smile
Reply
#3
Thanks Jordan. Smile
Reply
#4
This user has been denied support. This user has been denied support.
Can this be implemented with the mybb chat system?
Cause i was using a mybb chat plugin where the timezone varies on the ADMIN timezone.
Hope this one will solve ,y problem. I'll test it later. Thanks.
Reply
#5
If the chat plugin uses the timezone settings from the MyBB settings, then yes. Which chat plugin are you using?
Reply
#6
thanks for the tut
Reply
#7
This user has been denied support. This user has been denied support.
the SQL query will be executed in the phpmyadmin?
Reply
#8
Yes, that is correct.
Reply
#9
hello..

Great work..
Its really very good to how the step by step tutorial with all of us...
Reply
#10
This user has been denied support. This user has been denied support.
thanks for helping me..
as i was searching for it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)