The Drupal theme_default is the one you must set to switch themes using variable_set .
variable_set('theme_default', 'your_theme_name');
You can change the default theme with hook_update_N if you already have a custom module installed. Also, make sure you call the code in hook_install to run it during installation, if you want to share your module with someone else and want to change the active theme during installation.
/** * Implements hook_update_N(). */ function mymodule_update_7000() { $theme_list = array( 'bootstrap', 'mytheme', 'shiny', ); theme_enable($theme_list); $theme_default = 'mytheme'; // The below code would change the default active theme to 'mytheme' variable_set('theme_default', $theme_default); $admin_theme = 'shiny'; variable_set('admin_theme', $admin_theme); }
D34dman
source share