Disabling UTC time zone selection in user profile

Disabling UTC time zone selection in user profile

by Kevin Roberts -
Number of replies: 1
Is there a way to disable UTC time zones from appearing in the list of time zones a user can select in their profile?

We have users world-wide. If they select a UTC time zone in their profile, scheduled events like facetoface sessions (from the face-to-face module) appear incorrectly when daylight saving time (DST) is in effect. If they select one of the "city" time zones, the session times are displayed correctly and adjusted for their own time zone/DST.

After downloading the latest time zones from the admin Location menu, I would like to remove the UTC time zones so that a user can only select (by default) the server's time zone, or the appropriate city time zone.

Can this be done?
Average of ratings: -
In reply to Kevin Roberts

Re: Disabling UTC time zone selection in user profile

by Richard Enison -
KR,

The short answer seems to be ... no.

The long answer? Well, since one can get Moodle to do whatever you want by editing the program (script) code (they don't call it Open Source for nothing!), presumably you were asking if there was already a way to get Moodle to remove UTC from the list without changing the code. To find out, first I had to find where the code for handling the time zone in a user profile was.

So I fired up Apache and browsed to localhost where my Moodle site lives, and brought up my profile. The answer is: user/editadvanced.php. I clicked on the Timezone drop-down list button to see what the choices were. Every choice is UTC plus or minus some number of hours, except one. That one is Server's local time. If you were to remove UTC from the list, that wouldn't accomplish anything because
  1. all the other entries are relative to UTC except one,
  2. the one remaining entry would give everybody in the world the same time zone, namely, the one where the server is, and
  3. people living in the same time zone as London, England would not be able to select their own time zone.
So what you really want to do is get rid of the entire list, and replace it with a list with one entry: User's local time. Or maybe two entries: Server's local time and User's local time

I was pretty sure that if there was a way to configure the Timezone list, it would be on the Administrator menu. When I went to that menu, the only submenu where it would be was Users, then the Accounts submenu of that. In short, it's not there. I don't think I need to look at the source code to find that out.

But as I said, you can do anything by editing the code. I could probably help you with that (but not for free; shhh, don't tell anybody!); you can send me a private Moodle msg. if you want. And pls be specific as to what change you want.

RLE