function role_theme_switcher_init in Role Theme Switcher 5.2
Same name and namespace in other branches
- 6 role_theme_switcher.module \role_theme_switcher_init()
Implemntation of hook_init().
File
- ./
role_theme_switcher.module, line 6
Code
function role_theme_switcher_init() {
global $user, $custom_theme, $theme;
foreach ($user->roles as $key => $value) {
$role_name = str_replace(' ', '_', $value);
$role_theme = variable_get(strtolower($role_name) . '_theme', '');
// Change active theme in user object
$user->theme = $role_theme;
// Also change the active theme globally
$custom_theme = $role_theme;
drupal_clear_css_cache();
}
}