In summary, deleting a View that automatically created the menu link to it, only deletes the View and not the link.

Here are the steps I performed, ultimate the link was deleted, but it's a bad workaround with errors:
1. I created a simple view with a Main Menu link using Views to add the main menu link.
2. When I deleted the View, the main menu item was not automatically deleted.
3. Clicking left over the link resulted in a page not found error (which is correct to a point I guess).
4. I disabled the link item in the the Main Menu page - There was no option to delete the link.
5. I then clicked Reset for the now disabled link, then following error occurred:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'link_path' cannot be null: UPDATE {menu_links} SET menu_name=:db_update_placeholder_0, plid=:db_update_placeholder_1, link_path=:db_update_placeholder_2, router_path=:db_update_placeholder_3, hidden=:db_update_placeholder_4, external=:db_update_placeholder_5, has_children=:db_update_placeholder_6, expanded=:db_update_placeholder_7, weight=:db_update_placeholder_8, depth=:db_update_placeholder_9, p1=:db_update_placeholder_10, p2=:db_update_placeholder_11, p3=:db_update_placeholder_12, p4=:db_update_placeholder_13, p5=:db_update_placeholder_14, p6=:db_update_placeholder_15, p7=:db_update_placeholder_16, p8=:db_update_placeholder_17, p9=:db_update_placeholder_18, module=:db_update_placeholder_19, link_title=:db_update_placeholder_20, options=:db_update_placeholder_21, customized=:db_update_placeholder_22 WHERE (mlid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => navigation [:db_update_placeholder_1] => 0 [:db_update_placeholder_2] => [:db_update_placeholder_3] => [:db_update_placeholder_4] => -1 [:db_update_placeholder_5] => 0 [:db_update_placeholder_6] => 0 [:db_update_placeholder_7] => 0 [:db_update_placeholder_8] => 0 [:db_update_placeholder_9] => 1 [:db_update_placeholder_10] => 552 [:db_update_placeholder_11] => 0 [:db_update_placeholder_12] => 0 [:db_update_placeholder_13] => 0 [:db_update_placeholder_14] => 0 [:db_update_placeholder_15] => 0 [:db_update_placeholder_16] => 0 [:db_update_placeholder_17] => 0 [:db_update_placeholder_18] => 0 [:db_update_placeholder_19] => system [:db_update_placeholder_20] => [:db_update_placeholder_21] => a:0:{} [:db_update_placeholder_22] => 0 [:db_condition_placeholder_0] => 552 ) in menu_link_save() (line 3064 of /home7/phillych/public_html/mudtraining/includes/menu.inc).

Comments

amanire’s picture

Seems related. I just tried to remove a menu item that I had created in association with a view but the menu item persists after the changing from Normal menu entry to No menu entry. I cleared all of the Drupal caches and the Views caches twice, but it still persists. Next, I disabled and rest the link as described above. I didn't get any error messages but I think it only moved the (now blank and disabled) menu item to the Navigation menu.

dawehner’s picture

      menu_rebuild(); // force a menu rebuild when a view is deleted.

A menu rebuild is triggered, so i'm not sure what to do else.

dawehner’s picture

What happens if you clear the cache?

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Update status

chrispooh’s picture

I have the same problem. After celaring cache is the same.

chrispooh’s picture

I see the menu in the menu_link table after set the views to no menu entry.

caligan’s picture

Also had this problem - I created a view with a menu item, saved it, then went back and changed to 'No menu item.' The entry stayed in the navigation, even after clearing the cache.

Possibly related to http://drupal.org/node/1079628 ? The menu item was left in both menu_links and menu_router, with menu_router:type set to MENU_CALLBACK.

merlinofchaos’s picture

As near as I can tell, this is a bug in core, which is remembering menus even after they are removed from hook_menu().

The work around seems to be to first change the menu item to a tab, and then remove it.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
philsward’s picture

Yeah, this has been going on since views 2.x on D6...

philsward’s picture

Changing it to a "tab" didn't work for me... After I changed the view menu to "no menu", I went into the Drupal Menu and hit "reset" which got it out of the Main Menu...

I think it has something to do with the weighting in the Drupal Menu now that I think about it... (not the weighting for the menu in the view). If you change the weighting in the Drupal Menu, you can't get rid of it until you "reset" it. If you don't touch ANY weighting (not sure about the view weighting), it will add and remove it as expected. (I think...)

hansrossel’s picture

#8 & #11: Changing the menu item to tab worked for me, but only when viewing the menu in between. So edit view, change to menu tab, save view, view the menu, open view again, change to no menu.

senortim’s picture

#12 isn't working for me.

I'll add that this menu item resolves to the view even when the view is disabled. *That* seems like a bug, too! :-)

I'll also add that in my use case, there is a work around: I have a Menu Block using a special menu, and my view has added its menu entry into this special menu. Because Menu Block lets you define a starting point, I have that set to one parent. So a solution for me is to make this Views-created errant menu item a sibling of that parent. Thus, it's hidden from the user.

jsibley’s picture

I believe that I experienced a version of this problem.

I was getting the error Undefined index: localized_options in menu_navigation_links() and couldn't figure out why. I am not using localization and I couldn't find the page in my menus. I did see entries in the menu_router and menu_links table, however.

I believe that the entries were created by a view. When I look at an export of the view (which uses a contextual filter) I see:

$handler->display->display_options['path'] = 'member-profile/%';
$handler->display->display_options['menu']['title'] = 'Members gallery';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'main-menu';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;

I'm wondering if removing the ['menu'] lines, deleting the current view and re-importing it might have fixed the problem.

However, I already seem to have fixed the problem by changing the path temporarily to one without the "%", saving, and changing the path back. I believe that this triggered something that allowed either clearing the caches or rebuilding the menus to work properly and remove the offending row from menu_router and menu_links.

Hopefully, this can help someone else at some point.

joshuautley’s picture

I tried the solutions above and none really worked. I ended up renaming the page path of my view to something else after following steps #8 and #11 which finally did the trick.

I then went back into the view (after flushing the cache and running cron just to be safe) and changed the page path back to what is was originally.

bisonbleu’s picture

Workaround in #8 works! - and no sql required. Thanks @merlinofchaos !

icf-vpathak’s picture

Great #8 worked! Thanks #12 for the explanation.

scotwith1t’s picture

The only thing that worked for me is to change it to a **Default Menu Tab** with Menu Tab in the settings (not just a Menu Tab on the first popup), then change back to No Menu. Thanks!