This report addresses concerns seen in Support and related postings across Drupal ( http://drupal.org/node/613292 , http://drupal.org/node/1218606 , http://drupal.org/node/1233092 , http://drupal.org/node/997444 , http://drupal.org/node/1073994 , and probably many others ).

Essentially, the problem is that if the location of the "Add content" menu link is undesirable and needs to be elsewhere, reassigning the menu link to a different menu causes the following message to be displayed:

You have not created any content types yet. Go to the content type creation page to add a new content type.

And while the problem can be worked around by moving the menu link back or possibly placing links for the specific Content Types below it in its new menu, the fact of the matter is that the resultant message listed above is in error. This coupled with the fact that this is probably one of the only instances I can think of where an administrative page cannot be relied upon to actually perform it's primary function if certain seemingly unrelated changes are made (imagine going to /admin/modules and getting a message saying that you have no modules running on the site despite the fact that you reached the page).

If the reasoning behind the current logic were that you could hide certain add Content Types from the Add content page, this was errant thinking IMO. If you're hiding the link yet still want the user to be able to add the Content Type, then you must be getting them to the /node/add/[nodetype] page via another link or some other function that takes them to the page after all and if that's the case then the link/function therefore must be buried in some other Menu or Block or something. If you're using other Menu Blocks or other means to funnel the user to the /node/add/[nodetype] pages, then you're probably not using the default /node/add page so what does it matter if the link is visible there or not since you're not even using it? And even if you still want them to have access to the original admin /node/add page, it seems you're already making custom Menu Blocks or something so what's one more to set which Menu Links should actually appear there or not?

If one wants the Menu Links for the particular Content Types to be hidden and to also be non-responsive, then one sets the permissions on the user's ability to create that particular Content Type and the Menu system honors the permission by not bothering to render Menu Links to pages a user doesn't have access to.

(It also seems like when moving the "Add content" Menu Item that sub-Menu Items should move with it but that warrants its own Feature Request with the Menu system.)

The crux of the problem seems to be that the /node/add page is displaying/acting like a Menu Block (because it is, actually), yet people expect it to display/act like a standard administrative page. I marked this as high priority since this can have the effect on new (and even veteran users) of having them believe that their site's database has become corrupted, leading to all sorts of wasted time and dead-ends. It is especially so since it is not immediately apparent what the implications to the /node/add page are until you finally visit it. During a site build, you may go a week or so building and testing functions and setting up menus before hitting the Add content page--never realizing that what caused the issue was a menu setting you did days ago--not something that just happened. This is extremely frustrating and leads to posts like this ( http://drupal.org/node/1073994#comment-5160650 ) and leaves a generally bad taste in new users' mouths upon first trying out Drupal.

The source of the problem is here (L. 18-27 of node.pages.inc):

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  // Bypass the node/add listing if only one content type is available.
  if (count($content) == 1) {
    $item = array_shift($content);
    drupal_goto($item['href']);
  }
  return theme('node_add_list', array('content' => $content));
}

Specifically, this admin page's content is constructed as a Menu Block--

  $content = system_admin_menu_block($item);

--and therefore behaves like one with regard to sub-menu items, etc--where it should not. It should list all the Content Types that the user has permissions to actually add--not just display which sub-menu items are arranged below "Add content" in the Menu hierarchy.

Comments

catch’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #550254: Menu links are sometimes not properly re-parented, see you over there!

digitalfrontiersmedia’s picture

Status: Closed (duplicate) » Active

I disagree that this is a duplicate.

The reasoning is that due to the way node_add_page is written, all I have to do is move one of the sub-menu items out from beneath the "Add content" Menu Item and the Create content page will fail to show the Content Type. Following this to an extreme, if you moved all the sub-menu items, the page would again tell you:

You have not created any content types yet. Go to the content type creation page to add a new content type.

when in fact that is not the case.

As I pointed out above--imagine going to /admin/modules and getting a message saying that you have no modules running on the site despite the fact that you reached the page.

If you need a custom menu block of Content Type add links, there are already mechanisms to do this. But as I stated the Core path /node/add should always return all the Content Types that the user has permissions to actually add--not just display which sub-menu items are arranged below "Add content" in the Menu hierarchy. A Core admin page shouldn't be so flimsy for new users. #550254: Menu links are sometimes not properly re-parented is merely the bug that reveals this one.

digitalfrontiersmedia’s picture

Additional reasoning why this is a separate bug:

After one has moved the Add content Menu Item and/or its sub-Menu Items to a different Menu than the default (Navigation) and then installs a new module that includes a new Content Type, the new Content Type will NOT be displayed at /node/add due to the fact that the module by default usually places the new menu link under the Navigation menu--NOT under the Add content Menu Item in its new home. How/why would it know where you may have moved the Menu Item? Why should it care? Answer: It shouldn't. /node/add should always by default simply list all the Content Types that the user has permissions to actually add--not just display which sub-menu items are arranged below "Add content" in the Menu hierarchy.

hefox’s picture

Status: Active » Closed (duplicate)
DrJordi’s picture

The ones that only says this is a duplicate could post an answer, t it is really nasty to hear that kind of useless comments while you ask for help. I read all the "duplicates" and doesnt seem to have a solution. Please help!!