Last updated October 3, 2011. Created by LeeHunter on December 14, 2007.
Edited by dman, Shai, m1mic, bekasu. Log in to edit this page.
Situation:
Either you have installed or modified a theme that just breaks everything, or you've deleted the current theme without disabling it first.
As you've now learned, you should have switched out of the theme via administration before destroying it, because you are left with nothing or almost nothing as a UI to work with now.
But we can probably recover.
If you see some content but no navigation blocks
We can fix up the themes by going directly to the required pages.
- You'll have to be logged on, so enter http://example.com/?q=user in the browser. Logon as normal. (use your own Drupal path of course)
- Enter http://example.com/?q=admin/build/themes (D5) or http://example.com/?q=admin/themes (D4) to see a version of the themes page. Select a valid theme (eg BlueMarine) and things should be in a state where you can continue.
If you see no content at all, maybe garbage or a totally blank screen or the above doesn't work...
If you have drush, the command to type would bedrush vset theme_default garland
If you haven't installed drush yet, we need to do surgery on the database.
It's easier if you choose a theme name that you know used to work, eg 'garland' or 'bluemarine' for D4.
Either on the commandline, or via an administration interface (eg PHPMyAdmin) enter the following query
UPDATE system SET status=1 WHERE name = 'garland';Then either:
UPDATE variable SET value='s:7:"garland"' WHERE name = 'theme_default';
TRUNCATE cache;Note that 's:7' refers to the length of the following string. Modify as needed. This is database surgery, tricky stuff.
OR
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';Be careful, as getting either of those lines wrong can mess things up just as badly.
If you see some of the theme, but no navigation blocks, you may be able to proceed as in the first case, described above.
That didn't work
It's hard to guess how badly your system is damaged at this point. Did you delete the phptemplate directory?
Try re-uploading the entire contents of the /themes directory from a clean distribution of the exact same version of Drupal.
See Also:
Disabling Modules via phpMyAdmin
Download a fresh copy of a missing or corrupted module/image/file
Linux Folder Permissions
The White Screen of Death occurred while installing the Zen theme for Drupal 5. Renaming the folder from zen to zen-base, and then nothing worked - white screen. Renaming the folder back to zen allowed got the site working again. The solution came from reading this issue: http://drupal.org/node/222934
The problem was complicated by the fact that after unzipping the zen files into the theme directory (fedora linux), but forgetting to set (chown -R) the owner and group of the directory and files it contains to the right users. The theme still shows up in the admin section, but if enabled and it and the directory and files belong to users without permissions, you also have problems with white screens.
It was trying to fix this, without realizing that the owner and group were wrong, followed by renaming the folder, that compounded the problem.
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.
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?
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.
Devin
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!
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 existThat 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';