How can I delete an unused block type?

I have a rogue block that I built with Designer Content, I didn't get it working quite the way I wanted first time round so I deleted it and built another one.
To remove the old one I just deleted its folder under /blocks, with hindsight I guess I shouldn't have done this but I thought since it wasn't being used on any pages it would just disappear - no. Now I have both blocks in my list of block types - the 'real' one is used 40-odd times, but the deleted one is 'used' once. Even though it's not in use.

Whenever I try to remove it, it says Usage Count = 1.
But this block is not on any existing page, or anywhere in the trash, and the cache has been cleared dozens of times. I'm pretty sure it's not on an old page version (but I have a LOT of pages and it is hard to tell, I have removed as many old versions as I can manually but I can't auto-remove old versions).

Is there any way at all of figuring out where it thinks it is finding this mystery block?
I just want to stop it from appearing in the Block Type list, as I now have two blocks with the same name there (and if you click the non-existent one you obviously get an error!)

Also, when I try to do Remove Block, initially I got an error message like
Fatal error: Call to a member function deleteBlock() on a non-object in /public_html/concrete/models/block_types.php on line 691

Now when I click Remove, it tries to go to a URL like

but this just gives an HTTP 500 Error.

I found a post here that looked kind of related but didn't really help:

I would really appreciate it if anyone has any ideas
Thanks very much

View Replies: View Best Answer
mnakalay replied on at Permalink Reply
one problem you may have is that when deleting the folder containing the block, you left the database table behind. Now you should find and delete it manually.

Designer Content use a simple naming convention, Say your block was called my_custom_block, then the table you need to delete would be called btDCMyCustomBlock.

After you do that, you might see things go back to normal.

Good luck
prestressed replied on at Permalink Reply
thanks that sounds about right - except currently I don't know how delete a table manually - any chance of some instructions-for-dummies?

Can I use this?
(Sorry, totally new to this, never messed with my databases before!)
gd42 replied on at Permalink Reply

But your host most likely has some configuration utility (most likely phpMyAdmin), where you can access and edit your database. It is also useful for making full backups and exporting the database if you want to move your site.

Just curious: How do you develop if you haven't messed with databases before? You do everything on a live site?
prestressed replied on at Permalink Reply
mmm, I do everything live. Although I suppose I make & develop my own themes locally in Dreamweaver. Historically I come from a Dreamweaver background, I'm not a programmer, and I have only quite recently started building database-driven sites so all the SQL stuff is out of my comfort zone. I started with a couple of really small sites and working live wasn't a problem. But now I've got a bit hooked on c5 and I have half a dozen sites and more planned, and they are getting a lot bigger and more complex as I read more on the forums, learn more PHP and figure out what's possible.
I'm not really sure what the major downsides are of doing things the way I am - seems like a lot of people here (well, the newbies particularly!) work on live sites?
mnakalay replied on at Permalink Best Answer Reply
as gd42 said, you can use that or phpmyadmin. Your host probably offers you access to phpmyadmin.
When you see the interface, you will have a column on the left hand with a list of databases. Click on the database's name you are using for concrete5 (you named it yourself during the install so you should know the name)

The left column will change to a list of all the tables in the database. The main central screen will also show you a list of all the tables.
Find the table you want to delete. to delete it you have to possibility. either you click on the red button that says "drop". The button is aligned with the name of the table and other buttons (Browse, structure, search...)
Or you can check the box next to the name of the table then go at the bottom of the page and, in the dropdown list that says "With Selected" you select drop.
After that of course you confirm and you're good.
prestressed replied on at Permalink Reply
Thank you so much for the advice mnakalay! The wretched block is finally gone! (Easy when you know how...)

I deleted the btDC table that I didn't want any more, then I saw the table called BlockTypes, I had to delete the relevant row in that table too and finally it was gone from the list. Brilliant.

I asked this question a couple of months back and noone replied to me so I am really grateful you took the time to help.
mnakalay replied on at Permalink Reply
You are very welcome.
You know sometimes what happens is that a lot of messages get posted at the same time and some of them go unnoticed. Usually what you do is wait a bit (say a week) and if no answer, go back to your thread and says something to yourself like "Bump" so your message goes back on top of the list. That might give it a second chance of being seen.
drennapete replied on at Permalink Reply
You are a boss, I was losing my mind trying to remove several designer content blocks. I deleted the block in the database, removed the folder in my ftp, cleared the cache, removed anything remaining in my block list.

And its fixed.

jlines41 replied on at Permalink Reply
Thanks a bunch!