Situation:
Either you have installed or modified a theme that just breaks everything, or you've deleted the current theme without disabling it first.
Initial checks
- Try clearing or rebuilding your CSS/JS and theme caches
- Make sure you have installed the new theme in the correct location (e.g.
/sites/all/themes
for D5–7,/themes
for D8 - Make sure the file ownership and permissions of the new theme files is correct (i.e. whichever user Drupal runs as, typically the same as the web server, can read and execute)
- Make sure you have installed any base theme that may be required
- Make sure you have installed any dependencies that may be required by the theme, such as jQuery libraries or contrib modules
If you see some content but no menus or navigation blocks
We can fix up the themes by going directly to the required pages.
- Log in to your Drupal site, i.e. http://example.com/?q=user
- Browse your themes page and select a theme you know to be working:
- Clear or rebuild your CSS/JS and theme caches
If the problem theme still appears, check that it has not been forced in your settings.php
file.
If you see no content at all, only error messages or a totally blank screen and you cannot login anymore.
Method 1: Change the active theme with Drush
You can change your default theme with a drush command, for example
# for Drupal 6/7
drush vset theme_default garland
# for Drupal 8 (Drush 7+)
drush config-set system.theme default bartik
Then, clear or rebuild your CSS/JS and theme caches. If the problem theme still appears, check that it has not been forced in your settings.php
file.
If drush fails with an error, it is likely you have other problems with the installation besides or in addition to the theme, such as an incompatible module.
Method 2: Change the active theme in the database
The default theme setting is stored in Drupal's database, and thus can be changed by manipulating the database from the command line or an administration overlay or client like PHPMyAdmin or MySQL Workbench for MySQL.
Always make a backup of your database before changing values in it directly, as it is possible to destroy data and render your site unrecoverable at the database level. You have been warned.
In Drupal 6 and 7, the setting is stored in the system
table:
# activate a trusted theme
UPDATE system SET status=1 WHERE name = 'garland';
# change the default setting
UPDATE variable SET value='s:7:"garland"' WHERE name = 'theme_default';
# clear the cache tables
TRUNCATE cache;
TRUNCATE cache_bootstrap;
TRUNCATE cache_block;
Note that 's:7' refers to the length of the following string. Modify as needed. This is database surgery, tricky stuff.
If you are using per-user themes, and you've just messed it up for yourself as admin, try
UPDATE users SET theme='garland' WHERE uid = '1';
In Drupal 8, the setting is in the config
table, and stored as a blob value for system.theme
.
Method 3: Remove theme files
Remove the files of the bad theme and clear or rebuild the cache. After clearing the cache you should be able to log in again. The site will not look very pretty until you change to a working theme, but the menus should be navigable.
Comments
Clear Theme Registry Cache
One thing that can exacerbate the situation is the theme_registry value in the cache table. I my case I was working on a theme and had moved files, but this setting was holding on to the old location of files and not finding them. Also the variables row can have an effect as well. They can both be emptied fro the database manually rather than trying empty the cache from the Performance admin. These rows did not seem to be affected either that way or by running cron. Only when emptying them directly did the changes reflect immediately.
Drush helps here
I read this page: http://drupal.org/node/530780
Comment #24 shows a simple way to set the default theme and the admin theme from the command line / terminal window / SSH using drush.
List themes: drush pm-list --type=theme
List enabled themes : drush pm-list --type=theme --status=enabled
Set the default theme: drush vset theme_default
Set the admin theme: drush vset admin_theme
Thanks
I know it's been quite some time since you posted this but I just wanted to say thanks for adding this in this post. I'm loving drush more and more everyday and at least pat myself on the back a little for installing it and getting familiar when others said they weren't ready for it. Thanks again I need that 2 sec fix.
Steel sharpens Steel !
works in Drupal 7
Confirmation that
UPDATE variable SET value='s:7:"garland"' WHERE name = 'theme_default';
TRUNCATE cache;
Then just had to disable the themes i had enabled then enable my original site theme and set as default
This is really stupid
It is really, really stupid that one has to go into MySQL to recover a corrupted or bad theme. Is there a bug or a feature request trying to change this in D6 or D7? Maybe have a theme override in settings.php or be able to have a fall-back if you rename the theme in sites/all/themes or something that doesn't require you backing up your entire database in case you make a mistake?
set it in your sites/default/settings.php
set it in your sites/default/settings.php:
$conf['theme_default'] = 'minelli';
Very simple and easy solution
Very simple and easy solution, worked for me !!
Thank you so much !!
Low Tech Solution
Rename your non-working theme folder. Copy a simple, working default theme folder to your all/themes folder next to your non-working them folder and give it the original name of your non-working theme. Delete the default theme's .info file and copy over the one from your non-working theme. Go to your site. Drupal should now launch the default theme copy in place of your non-working theme and give you enough functionality to set your theme to something other than your non-working theme in the theme admin panel.
this works
thank you Devin, your solution worked for me. Now i know that before performing a major update, one should.. a) Put the site in maintenance mode; b) Take a full backup; c) Disable all non-core modules; d) Set your theme to Garland (this is what I didn't do. and got into trouble).
SKBando
Yep.
"Low Tech" or KISS ... whatever; it WORKS. Good post, devin1492 :-)
Thanks delvin1492
Brilliant! That sneaky trick saved me!
drupalshrek
thank you...it works :)
thank you...it works :)
Great tip - thanks!
Devin1492, this was a really helpful tip. Thanks!
This worked for me
Thanks devin1492. Got me out of a mess and only thing that seemed to help.
I used a copy of the Bartik theme (using Drupal 7).
However I knew there wasn't much wrong with the theme that crashed the site (tried it on another), but it just wouldn't load on the one that crashed. Managed to log in and reset cache (and all the other tips) and everything, but no joy.
Anyway, I found (accidentally) that if I disabled the theme and then enabled it before setting it as default, something (presumably in the database) got fixed.
This latter, extra step may help some folks. . .
Problem with resetting theme
After making adjustments to the Bartik theme, the site shows up in a theme without background & without admin bar and there is no way to reach the admin settings
Tried to remove the adjusted theme and cleared the caches (update.php and clear.php) but doesn't give any result
Following notice comes up
Notice: Undefined index: highlighted in include() (regel 126 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_first in include() (regel 138 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_second in include() (regel 144 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/modules/system/page.tpl.php).
Notice: Undefined index: bartik_marc in drupal_theme_initialize() (regel 100 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/includes/theme.inc).
Notice: Trying to get property of non-object in _drupal_theme_initialize() (regel 145 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/includes/theme.inc).
Notice: Trying to get property of non-object in _theme_load_registry() (regel 334 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/includes/theme.inc).
Notice: Undefined index: bartik_marc in theme_get_setting() (regel 1414 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/includes/theme.inc).
Notice: Trying to get property of non-object in theme_get_setting() (regel 1461 van /Users/marcnoel/Documents/Websites PHP en docs/MAMPdocs/includes/theme.inc).
any idea how to get back to a working drupal?
using Drupal v7.17
Thanks Devin1492
Thank you Devin1492, as a non-tech type I took my courage in both hands and tried your suggestion, saved the day for me.
BLESS YOU FOR THIS. :) It
BLESS YOU FOR THIS. :) It absolutely works.
If either of your
If either of your default/admin themes work, you can grab the blob from that record (admin_theme or theme_default) and paste it in the breaking value's blob.
mySQL error
I somehow got rid of the main contents block on a theme, and now absolutely no content is showing on any pages, including the admin pages. I'm trying to reset the theme using this method but I run into this mySQL error:
#1146 - Table 'webibek7_SMFDdr.system' doesn't exist
That table definitely exists!
Any ideas or does any one have another reset for my particular issue?
Thanks!
admin theme
Thanks for this!
I also had an instance where the admin theme was set to the same broken thing as the normal theme.
In that case you can add this query to your list:
UPDATE variable SET value='s:7:"garland"' WHERE name = 'admin_theme';
Thanks
It works.
The database thingy helped
When i installed the Omega theme with Ohm subtheme, i could not log in anymore.
Thanks.
Resetting Drupal 8 *admin* theme with drush
It's worth mentioning this command:
admin theme reset to bartik:
default theme reset to bartik:
To go along with the default theme change in the original post...If you've screwed up your admin theme, changing the regular default theme won't get you back into your admin UI.
And don't forget to rebuild cache after changing the theme:
(Note: for v6) Update table
(Note: for v6) Update table manually: UPDATE `tfmain`.`variable` SET `value` = 's:7:"garland";' WHERE `variable`.`name` = 'admin_theme';
I think the documentation on
I think the documentation on this page should have two separate entries for resetting the main theme as well as for resetting the admin theme as follows
modulist
@modulist
Exactly the right commands.
So I installed an admin theme
So I installed an admin theme and it appears that it had an issue with the "main content" region. I now only have the menu system being output to the front end with no way to change any settings. I don't have Drush installed either. Is there a way to recover this installation or should I just start over (it's in the very early stages of development)?