function themekey_user_profile_form_alter in ThemeKey 7.2
Same name and namespace in other branches
- 7.3 themekey_user_profile.module \themekey_user_profile_form_alter()
- 7 themekey_user_profile.module \themekey_user_profile_form_alter()
Implements hook_form_alter().
File
- ./
themekey_user_profile.module, line 51 - ThemeKey User Profile allows the user to select a personal theme in her user profile. This theme will be used to render the pages instead of the theme the administrator configured as soon as the user logs in.
Code
function themekey_user_profile_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'user_profile_form':
if (user_access('select different theme') && variable_get('themekey_ui_user_profile', 0)) {
module_load_include('inc', 'themekey_ui', 'themekey_ui_admin');
$theme = !empty($form_state['input']['theme']) ? $form_state['input']['theme'] : !empty($form_state['user']->theme) ? $form_state['user']->theme : 'default';
$tmp_form = array();
themekey_ui_theme_select_form($tmp_form, t('Theme configuration'), t('Selecting a different theme will change the look and feel of the site.'), $theme ? $theme : 'default', NULL, TRUE, 'theme');
$form['theme_select'] = $tmp_form['themekey_ui_themes'];
}
break;
case 'themekey_ui_settings_form':
$form['themekey_ui']['themekey_ui_user_profile'] = array(
'#type' => 'checkbox',
'#title' => t('Add theme option to user profile'),
'#default_value' => variable_get('themekey_ui_user_profile', 0),
'#description' => t('A User is able to select a personal theme other than the default theme set by the site administrator.'),
);
$form['#validate'][] = 'themekey_user_profile_themekey_ui_settings_form_validate';
$form['#submit'][] = 'themekey_user_profile_form_alter_submit';
break;
case 'themekey_help_tutorials_form':
module_load_include('inc', 'themekey_user_profile', 'themekey_user_profile_help');
themekey_user_profile_help_tutorials($form);
break;
}
}