When the new user gets saved to the database, the timezone is saved in a format inconsistent with Drupal 7.

In Drupal 6 the timezone is stored as an offset from GMT in seconds whereas in Drupal 7 the timezone is stored in PHP timezones as detailed here.

It is currently defined as the following:

$user->user_timezone = $user->user_timezone * 60 * 60; # Drupal stores timezones in seconds

In the update from D6 to D7 user_update_7002 is what alters the timezone from an offset to a 'friendly timezone' so perhaps parts of that could be implemented, although that just sets it to NULL.

Another usecase could be to use http://php.net/manual/en/function.timezone-name-from-abbr.php for example:

$second_offset = $user->user_timezone * 60 * 60;
$user->user_timezone = timezone_name_from_abbr("", $second_offset, 0);

Comments

adammalone’s picture

Title: Timezones are incorrectly saved for Drupal7 » Timezones are incorrectly saved for Drupal7 [patch attached]
Status: Active » Needs review
StatusFileSize
new869 bytes

I've not tested this out to see if it works as I don't have a PHPBB database to draw from anymore. I just noticed this issue after cleaning up an old migration as some users couldn't log in as it would white screen when the user tried to log in.

Patch attached, check it out and see if it works!

adammalone’s picture

StatusFileSize
new868 bytes

I've just rerolled without the whitespace I noticed in there.

JeremyFrench’s picture

Status: Needs review » Fixed

Patch works nicely. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.