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:

<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:

<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):

UPDATE `mybb_users` SET `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):

UPDATE `mybb_users` SET `timezone` = '-10'

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

UPDATE `mybb_users` SET `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:

UPDATE `mybb_users` SET `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


Messages In This Thread
How to set all users to the same timezone and stop them from changing it - by faviouz - 2011-06-27, 11:07 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)