Last updated 23 February 2013. Created on 10 May 2007.
Edited by LeeHunter, mvc, dman, figaro. Log in to edit this page.

When developing a site it can happen that a module and theme are being given the same name. This results in very weird behavior: overriding hooks can make your blocks disappear, print $content returns only 'array', hence disappearing admin interfaces which force us to alter the database to get back on track.

Now we have to find out how to remove the new theme and switch back to an old one. if your site is big, with lots of content, then reinstalling is not an option. I tested this with MySQL, so these hints are for MySQL only.

Make a backup of your database first. We are going to edit the dumped records, and reinsert the database. I used this method because using my favorite editor is way easier and safer than using MySQL shell (anyway we shouldn't edit a live site database).

The theme name is registered in the following tables in your database: system, variables and block. Clear the cache manually, meaning to remove all the INSERT INTO `cache_` lines in order to see results. Change the 'default_theme' value in `system`. Note that 's' stands for string length, so be sure you put the string length after the 's:'. Also make sure you change the value to an existing theme (available themes are listed in `system`). And remove, or rename your troublesome theme.

The change in `block` is imperative, otherwise the blocks will not appear. Drop your old database from the sql server and insert the edited one. Voila, we have recovered from a theme crash.

Never give a module and a theme the same name

It leads to undesirable behavior of your webserver and is hard to recover from. Use clientname.module and /themes/clientname_2007/
as themes are more change-sensitive, while client-specific code just layers up.

Drupal officially does not support duplicate names which means that things will break if you do that. A patch which adds a warning when a site has a module and theme with the same name is in development for Drupal 8: #371375: Never name a module and a theme the same name!. Until then, well, you've read this page, so now you know better.

And remember, don't start a module or theme name with a number, and use underscores (_) not dashes (-) in names.

Looking for support? Visit the forums, or join #drupal-support in IRC.


hkirsman’s picture

I hope that uninstalling both the module and theme solves any issues that might have risen from this conflict.