You are here

function date_timezone_update_user in Date 6

Same name and namespace in other branches
  1. 5.2 date_timezone/date_timezone.module \date_timezone_update_user()
  2. 6.2 date_timezone/date_timezone.module \date_timezone_update_user()

Callback from user timezone settings form to update user timezone info. When the timezone name is updated, update the offset as well.

1 string reference to 'date_timezone_update_user'
date_timezone_user_form in date_timezone/date_timezone.module
Override form for the user timezone settings form. Display a list of timezone names instead of offsets and hide the offset value.

File

date_timezone/date_timezone.module, line 111
This module will make the alter the user and site timezone forms to select a timezone name instead of a timezone offset.

Code

function date_timezone_update_user($element, &$form_state) {
  $timezone = $element['timezone_name']['#value'];
  if (!empty($timezone)) {
    $date = date_make_date('now', $timezone);
    $offset = date_offset_get($date);
    form_set_value($element['timezone'], $offset, $form_state);
  }
}