I recently ran into a bit of a conundrum when working with an Orchard site. I installed a theme that ended up being incompatible with my current version of Orchard, which broke the front end of my site. To make matters worse, I somehow became logged out while experimenting with this. If you’re like me and end up in this situation, you’ll find that there is no way to log back into your site to remove the broken theme, since you can’t access the login page. Oops!
There is obviously a way to disable the theme through the database, which we’ll cover here. It’s pretty simple, really. If you don’t have access to the database, I’m not sure how you would actually fix this. Leave a comment if you know!
Open up your database in SQL Server. There are two tables in particular we want to look at – Settings_ShellFeatureRecord and Settings_ShellFeatureStateRecord. Delete any rows that have the name of your theme in them.
Next, navigate to the App_Data folder in your Orchard.Web directory and delete the cache.dat file from this folder. This is an important step, as Orchard will cache your active theme and continue to use it even if the database says otherwise.
Restart your application in IIS and when the site loads it should revert back to the default Theme Machine. Your site probably won’t look great if you were using another theme, but you can at least log in to manage your site from the admin area again.
This same approach works with modules, but can be especially valuable with a Theme that is locking you out of your entire site!