Close

Recovering from a Menu Deletion

One of my clients deleted their main menu by accident. No, they didn’t just delete some menu items but deleted the Main Menu from the menu manager. Obviously this caused all sorts of problems as one cannot recover from something like this using the Menu Trash feature.

Luckily there’s a workaround. I could still see the actual menu items in the module manager assignment area so something was still lurking in the database. I created a new menu with type “Main Menu” in the menu manager but noticed that when it was saved that the “Type” was set to “Main-Menu”. hmmm, time to dig around in the database.

I didn’t have access to phpmyadmin so I installed Art-Adminer, a sort of phpmyadmin clone extension. Right, so once this was installed and relevant password entered I could look at the database tables. First up “Select * from jos_menu“.
Bingo! all of the old menu items were still in there so this was definitely recoverable. Next step was to look in jos_menu_type (select * from jos_menu_type”). This just showed the menus that I could see in the menu manager already, as expected. This was just for verification.

Next step go into each item with in jos_menu with item type = “Main Menu” and set it to “Main-Menu”. You can do this individually using a db editor or just run an update, e.g.

UPDATE jos_menu
SET type=”Main-Menu”
WHERE type=”Main Menu”

Run the SQL and check the newly created menu. Yes, they are all back again!

Phew!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.