system_user
- Versions
- 4.6 – 6
system_user($type, $edit, &$user, $category = NULL)
Implementation of hook_user().
Allows users to individually set their theme and time zone.
Code
modules/system.module, line 136
<?php
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
$allthemes = list_themes();
// list only active themes
foreach ($allthemes as $key => $theme) {
if ($theme->status) {
$themes[$key] = $theme;
}
}
if (count($themes) > 1) {
$rows = array();
foreach ($themes as $key => $value) {
$row = array();
// Screenshot column.
$screenshot = dirname($value->filename) .'/screenshot.png';
$row[] = file_exists($screenshot) ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $value->name)), '', 'class="screenshot"', false) : t('no screenshot');
// Information field.
$field = '<strong>'. $value->name .'</strong>';
$row[] = $field;
// Reset to follow site default theme if user selects the site default
if ($key == variable_get('theme_default', 'bluemarine')) {
$key = '';
if ($edit['theme'] == variable_get('theme_default', 'bluemarine')) {
$edit['theme'] = '';
}
}
// Selected column.
$row[] = array('data' => form_radio('', 'theme', $key, ($edit['theme'] == $key) ? 1 : 0), 'align' => 'center');
$rows[] = $row;
}
$header = array(t('Screenshot'), t('Name'), t('Selected'));
$data[] = array('title' => t('Theme settings'), 'data' => form_item('', theme('table', $header, $rows), t('Selecting a different theme will change the look and feel of the site.')), 'weight' => 2);
}
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();
$data[] = array('title' => t('Locale settings'), 'data' => form_select(t('Time zone'), 'timezone', strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), $zones, t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')), 'weight' => 2);
}
return $data;
}
}
?>Login or register to post comments 