function timezone_detect_enable in Timezone Detect 6
Same name and namespace in other branches
- 7 timezone_detect.install \timezone_detect_enable()
Implements hook_enable().
File
- ./
timezone_detect.install, line 11 - (Un)installs the Timezone Detect module.
Code
function timezone_detect_enable() {
drupal_set_message(t('The Timezone Detect module was successfully enabled.'), 'status');
// Set default user timezone to "none." Otherwise this module will not do
// anything in its default configuration (set user timezone only if it
// is not set).
$user_default_timezone = variable_get('date_default_timezone_name', NULL);
if (!empty($user_default_timezone)) {
variable_set('date_default_timezone_name', 0);
drupal_set_message(t('Default user timezone set to "empty timezone" for best results with Timezone Detect.'), 'status');
}
// Disable "remind users at login if their time zone is not set." Otherwise
// users may be asked to set their timezone on first login even when this
// module has already set it via ajax callback.
$empty_timezone_message = variable_get('empty_timezone_message', 0);
if ($empty_timezone_message != 0) {
variable_set('empty_timezone_message', 0);
drupal_set_message(t('"Remind users at login if their time zone is not set" set to FALSE for best results with Timezone Detect.'), 'status');
}
}