Feature proposal is simple, as the title says.
Administrators have the option to enable or disable timezone selection on user registration form(disabled by default). When enabled, timezone selection list is available in the form, which is set to user's computer's default timezone, using javascript(similar to the automatic timezone selection on install.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gurpartap Singh’s picture

There was a function name typo.

Gurpartap Singh’s picture

Gurpartap Singh’s picture

Removed inline code usage, and have set the Global Killswitch in $(document).ready(function() {..}); in other words: in favor of http://drupal.org/node/120360

Gurpartap Singh’s picture

Title: Timezone selection at User register form » Auto timezone on user registeration
FileSize
4.16 KB

The title changes because we no more present timezone select field on user registration form, and no settings for it. The patch adds it silently to the registration form, it's a hidden field, and gets set in user_save upon submit.

m3avrck’s picture

I think this is fantastic idea and I've been using automatic timezone module for quite sometime.

The only problem I see though is in regards to DST and a user's offset will be affected when this happens. As a result, I think this check should happen more often than just user registration.

However, perhaps that DST patch goes in so maybe this is just superfluous talk...

Gurpartap Singh’s picture

Title: Auto timezone on user registeration » Automatically set timezone on user registeration
FileSize
3.46 KB

Re-roll.

Gurpartap Singh’s picture

dmitrig01’s picture

Status: Needs review » Reviewed & tested by the community

yup
tested it

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs review

I see you removed the install time check function, but then I don't see where you added the call to the generic timezone setting function. Did I miss it or is it actually missing?

dmitrig01’s picture

Status: Needs review » Reviewed & tested by the community

*cough*
its there, in the patch

Gábor Hojtsy’s picture

Maybe you could be a little bit more helpful?

Gurpartap Singh’s picture

The killswitch for it is put in the JS file itself, in .ready(...). And user.js is already included in install.php after ChrisKennedy's password checker patch.

KarenS’s picture

Re our attempts to get real timezone handling into core (http://drupal.org/node/11077), is there any way to use javascript to detect the name of the timezone, not just the offset?

m3avrck’s picture

Karen, potentially, the JS date object returns the following:

http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_date

On my computer it says "EDT" -- I can't confirm what other computers say, but would that help?

Here are the rest of the date object methods, I don't think anything else is too useful: http://www.javascriptkit.com/jsref/date.shtml

KarenS’s picture

In Firefox on Windows I get 'Fri Jun 29 2007 09:42:23 GMT-0500 (Central Daylight Time), which is possibly useful but doesn't really match anything in the timezone list. With IE 7 on Windows I only get 'Fri Jun 29 09:44:20 2007 ', which is no use at all. Sounds like there are lots of discrepancies.

How about country/city/continent info? The timezone database values look like: America/New York, or US/Central so maybe there's some way to get it that way, or at least to narrow down the possibilities.

m3avrck’s picture

Hmm this seems to be the best thread on the subject: http://groups.google.ca/group/comp.lang.javascript/browse_frm/thread/c68...

And the other: http://www.merlyn.demon.co.uk/js-dates.htm#ST

After reading a bit, the best we could hope for is the offset + whether or not the user has daylight savings or not, not much else.

KarenS’s picture

Hmmm, well thanks anyway for checking. Probably not much help.

Gurpartap Singh’s picture

Gurpartap Singh’s picture

Is this going to get in? It's really a straight forward patch. A "really" useful addition...

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Hm, I think this could be a nice usability enhancement, so IMHO it is possibly to get into Drupal 6. But I don't understand what is going on around "the killswitch":

+  // Field ID is overridden; so, JS doesn't change timezone on user edit forms
+  // upon killswitch call.
+  // Add the javascript Killswitch to automatically set the timezone.
+  drupal_add_js('
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    Drupal.setDefaultTimezone();
+  });
+}', 'inline');

"The" killswitch is the if (Drupal.jsEnabled) line. It is called a killswitch because if adequate JS support is not present in the browser, it does not run anything in the brackets. "The" killswitch does not set the timezone as the second comment says, neither it calls anything as said by the first comment excerpt.

I don't think the code comments in this patch are right. Or am I mistaken?

Gurpartap Singh’s picture

Sorry, I was mistaken. Will post updated patch after a few hours.

Gurpartap Singh’s picture

/few hours/

Gurpartap Singh’s picture

Status: Needs work » Needs review

P (CNR)

Gábor Hojtsy’s picture

Status: Needs review » Fixed
FileSize
3.8 KB

OK, this code was missing a configurable_timezones check, and I also reworded a comment a bit.
Committed the attached patch, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)