By nevets88 on
I tried updating the variable table, but it doesn't take. I looked for any files that might contain theme settings, but couldn't find it. Is it possible I missed another setting in another table in the database? Thanks.
I tried updating the variable table, but it doesn't take. I looked for any files that might contain theme settings, but couldn't find it. Is it possible I missed another setting in another table in the database? Thanks.
Comments
How to change default theme outside admin page
The question is a little vague, do you just want a different theme for the admin section?
Go to Administer > Site configuration > Administration theme.
More info
Here's the details:
I took out the left sidebar that contains the login and menu sections from the page php file
and when I login as administrator, I cannot get to the admin pages.
So I tried to change the default theme but not by using any Drupal webpages, but through
the database and/or files in the Drupal directory. I saw a table called variable, which holds
a row that contains the default theme, and changed it, but the theme stayed the same, so
there is someplace else that needs to be updated as well, an ini file or some some other
settings file?
I can put the sidebar back in, before I did all this, in the admin pages, I took the login
and menu blocks out of the default theme, so even if the sidebar is back, I'm not sure
I'll get the login and menu blocks back.
What if you add the sidebar
What if you add the sidebar code back to page.tpl.php?
Just remember, you can set the Navigation block to only display when you're in /admin, and if there's no blocks in a sidebar then the sidebar will not show up at all. There's almost no reason to remove things from page.tpl.php.
You should also be able to type the URLs of the admin pages to get to specific sections, eg:
With Clean URLs:
admin/build/themes
Without Clean URLs:
?q=admin/build/themes
Thanks
Ah, that's it. Much appreciated. Jumping ahead of the gun changing the theme.
Should get to know the admin pages better.
[Solved] Changing default theme outside admin page
Background
We wanted a role to be able to change the default theme of their website without having to deal with the configuration of the themes available through the admin pages.
Solution
We chose the switchtheme module because of the user friendly theme switcher block. Simply a dropdown list with available themes and a switch button. We edited the module a bit, removed the per user theme settings and allowed the authorized user to set the default theme as found in the variable table.
Instead of updating the "theme_default" value with db_query (as I suspect you've done) use the variable_set() function, which also does some important cache clearing. Here is the snippet we edited in the .module file:
Hope this was helpful.
[Solved] Changing default theme outside admin page
Hi, thanks for this post but I am having trouble achieving the same functionality (setting default theme from front end) can you advise how I can achieve this with the current version of switchtheme? Any help appreciated. Will.
function switchtheme_switch_form_submit($form, &$form_state) {
global $user;
if ($user->uid > 0) {
// Save the setting for authenticated users, if the "select different theme"
// permission has been granted.
if (user_access('select different theme')) {
$user = user_save($user, array('theme' => $form_state['values']['theme']));
}
// Otherwise save the setting in the session, just like for anonymous users.
else {
$_SESSION['custom_theme'] = $form_state['values']['theme'];
}
}
elseif (user_access('switch theme')) {
// Save the setting in the session for anonymous users.
$_SESSION['custom_theme'] = $form_state['values']['theme'];
}
}