4

In Drupal 7 some menu items, even though they exist in menu_links db table, do not appear in the menu. I wonder if it has something to do with cache, but I have disabled the cache and cleared it.

If I add a menu item that goes for instance to <front>, it appears in the menu, but if I add a menu item for a certain node, it does not appear. I can't find the logical reason for it.

  • Did you solve this? Have a look at Jan Tomka's answer. – cherouvim May 10 '12 at 12:38
8

The only reason I can think of is that the viewing user does not have access to the linked node. Internal menu links that point to unauthorised content do not appear in menu.

Make sure the node has been published and your user can view it.

Some people actually consider dolbydolby's work around a bug :-) http://drupal.org/node/483150

5

I also had this problem.

Building on Jan Tomka's answer, it appears that for unpublished nodes, when you create menu links these are indeed written to the database, but they do not appear in the menu, either on site (as you would expect), or - surprisingly - even in the list of menu links in the admin screens.

(This does not apply if you use an absolute url for the links, even if they are unpublished).

However, if these nodes are published, the menu links then appear both on site and in admin screens.

Not having menu items that are created appear in the admin screen - despite being written to the database - is counter intuitive, but as soon as I understood this behaviour I was able to work around it.

  • You are a god among men. This problem was driving me crazy until I read your post. Published the nodes and voila! Thank you. – Christian May 30 '14 at 8:48
  • Great answer. Seems weird that user 1 cannot see menu links they just added, only because of 'published' state. But true. – user18099 Aug 31 '14 at 8:24
  • Similarly, when the menu item's link becomes invalid (e.g. because you changed a view page's path in the meantime), the menu item is visible in the frontend but not in the admin screens. To fix this, I created a view to temporarily set to any path so that the menu item becomes temporarily accessible again and I can change it. Or if you know the menu item's ID, you can construct and call the path. – tanius Oct 7 '14 at 14:30
1

I spent days looking for a solution, but when I added the full path (http://example.com/?q=node/2) instead of the internal Drupal path (node/2) it worked, finally, I saw the menu item.

  • This works, but has three drawbacks compared to relative, internal Drupal paths: (1) Drupal won't use the current URL alias in the menu link, (2) Druapal won't prefix the link with the correct language prefix in multilingual setups, (3) when you switch Domains (like from testing to live site), you have to update all menu items manually. – tanius Oct 7 '14 at 14:33
0

Also I have this problem but i resolve it by delete the voice in the menu and after i add the same voice to the menu (linked to the same node) and it's all right, the menu appear. Try in this way.

0

We too experienced this problem: suddenly the first item of our main navigation (link to the home page) disappeared.

The link was also gone in the Admin > Structure > Menu. So I was not able to check the settings.

But in the table menu_links the item was still there.

I could solve the problem by changing some values for that entry in the menu_links table.

  1. I removed the value in *router_path* column (original value was node/%)
  2. I filled in a:1:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}} in the options column
  3. I set the value of the external column to 1 (original value was 0)

Then I cleared the drupal cache and the problem was solved!

0

In case you use Node view permissions you have to make sure that the Content Types you have linked into the menu for all (= incl. anonymous = "Guests") to see are not selected under .../admin/config/content/node-view-permissions.

If you select them to be included in the node view permissions process the menu items will not show up when a user is not logged in, but they can still see the content with the right path. The menu items do show for logged-in-users.

It is a reminder that you should use Content Types carefully and directly related to the User roles. IMHO it is not good to define access on a node by node basis to different User roles (or even individual users), this should be done through using Content Type and User roles in a structured way.

Therefore Node view permissions is the right module and one just has to remember to exclude all Content Types intended for anonymous users and that may be directly linked (relative path, i.e. node/x) to a menu when the page is created (.../node/add).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.