Reset menu sort “weight” in Drupal 6

One of the most amazing and annoying things in Drupal 6 is the menu system. Thanks to a bunch of JavaScript magick, you can drag menu items around to reorder them, create submenus, and so forth. Unfortunately, once you’ve moved a menu item it no longer alphabetizes itself. If you want things to alphabetize themselves again, you are left with two options:

You can manually alphabetize the menu or submenu every time you change things or add a new menu item, forever and ever and ever. If you’re not too keen on that idea, you can edit each of the menu items and reset their weight to 0, which makes them alphabetize again.

Neither option is ideal, so I created a third: this bookmarklet will set the weight of all menu items to 0 in one fell swoop. It also works for resetting block sort order, if you wanted to do that for some reason.

Just drag this bookmarklet to your bookmark bar (or right click and save the link):

Reset sort

After you use the bookmarklet you will have to save the page, just like when you reorder menu items by dragging them. Right now the bookmarklet doesn’t actually reorder them on the screen, so you’re just going to have to trust that it did what it says it did and submit the form. When I get a minute I might make it show the changes. But don’t hold your breath.

When you use this bookmarklet, you will reset the weight of every menu item or block on the page. If you don’t want to do that, I’d suggest alphabetizing your menu using option 1 or 2 above :)