If users are allowed to choose a theme for themselves, the selected theme is stored in $user->theme, where $useris the user object. The global variable $custom_themecontains the name of the currently installed theme, if a custom theme is defined in the module.
The following snippet is saved in the $current_themename of the current topic:
global $custom_theme, $theme, $user;
if (!empty($user->theme)) {
$current_theme = $user->theme;
}
elseif (!empty($custom_theme)) {
$current_theme = $custom_theme;
}
else {
$current_theme = $theme ? $theme : variable_get('theme_default', 'garland');
}
source
share