diff --git a/includes/menu.inc b/includes/menu.inc index 7449dc3f7e716f77b4c5522ba93267518fc30fbe..4679a5dacdf3a260032663fb643210d33345b1df 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -133,7 +133,12 @@ function menu_tree($parent = "") { $output = "\n<ul>\n"; usort($_list[$parent]["children"], "_menu_sort"); foreach ($_list[$parent]["children"] as $item) { - if ($_list[$item]["hidden"] == 0) { + /* + ** Don't render the menu when it is hidden, or when it has no call-back + ** nor children. The latter check avoids that useless links are being + ** rendered. + */ + if ($_list[$item]["hidden"] == 0 && ($_list[$item]["callback"] || $_list[$item]["children"])) { $style = ($_list[$item]["children"] ? (menu_in_active_trail($item) ? "expanded" : "collapsed") : "leaf"); $output .= "<li class=\"$style\">"; $output .= _render_item($item); diff --git a/modules/blog.module b/modules/blog.module index c2f11b90a4fcec0d43b5b2626b71fe0f425f2a06..0901eb052097a7b7f8f1cad4f0fb104f63b11784 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -261,10 +261,10 @@ function blog_link($type, $node = 0, $main) { if ($type == "system") { if (user_access("maintain personal blog")) { - menu("node/add/blog", t("blog entry"), NULL, NULL, 0); + menu("node/add/blog", t("blog entry"), "blog_page", NULL, 0); } if (user_access("maintain personal blog")) { - menu("blog/" . $user->uid,t("view my blog"), NULL, NULL, 1); + menu("blog/" . $user->uid,t("view my blog"), "user_page", NULL, 1); } } diff --git a/modules/blog/blog.module b/modules/blog/blog.module index c2f11b90a4fcec0d43b5b2626b71fe0f425f2a06..0901eb052097a7b7f8f1cad4f0fb104f63b11784 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -261,10 +261,10 @@ function blog_link($type, $node = 0, $main) { if ($type == "system") { if (user_access("maintain personal blog")) { - menu("node/add/blog", t("blog entry"), NULL, NULL, 0); + menu("node/add/blog", t("blog entry"), "blog_page", NULL, 0); } if (user_access("maintain personal blog")) { - menu("blog/" . $user->uid,t("view my blog"), NULL, NULL, 1); + menu("blog/" . $user->uid,t("view my blog"), "user_page", NULL, 1); } } diff --git a/modules/book.module b/modules/book.module index 9b828668abacc637799af5ee9774ad59d39f6564..2763fb20633de24095643abf6dcb31f654ae0d87 100644 --- a/modules/book.module +++ b/modules/book.module @@ -79,7 +79,7 @@ function book_link($type, $node = 0, $main = 0) { if ($type == "system") { if (user_access("maintain books")) { - menu("node/add/book", t("book page"), NULL, NULL,0); + menu("node/add/book", t("book page"), "book_page", NULL,0); menu("admin/node/book", t("books"), NULL, NULL, 4); menu("admin/node/book/orphan", t("orphan pages"), NULL, NULL, 8); menu("admin/node/book/help", t("help"), NULL, NULL, 9); diff --git a/modules/book/book.module b/modules/book/book.module index 9b828668abacc637799af5ee9774ad59d39f6564..2763fb20633de24095643abf6dcb31f654ae0d87 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -79,7 +79,7 @@ function book_link($type, $node = 0, $main = 0) { if ($type == "system") { if (user_access("maintain books")) { - menu("node/add/book", t("book page"), NULL, NULL,0); + menu("node/add/book", t("book page"), "book_page", NULL,0); menu("admin/node/book", t("books"), NULL, NULL, 4); menu("admin/node/book/orphan", t("orphan pages"), NULL, NULL, 8); menu("admin/node/book/help", t("help"), NULL, NULL, 9); diff --git a/modules/node.module b/modules/node.module index b310f070dcc23ebe108a0485f95bba3337118dd2..e7844a37bccd81fc0a054fd14b55169581dde5eb 100644 --- a/modules/node.module +++ b/modules/node.module @@ -551,17 +551,12 @@ function node_link($type, $node = 0, $main = 0) { $links = array(); - if ($type == "page") { - $links[] = l(t("submit"), "node/add", array("title" => t("Submit or suggest new content."))); - } - if ($type == "node") { if ($node->links) { $links = $node->links; } - if ($main == 1 && $node->teaser && strlen($node->teaser) != strlen($node->body)) - { + if ($main == 1 && $node->teaser && strlen($node->teaser) != strlen($node->body)) { $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read the rest of this posting."), "class" => "read-more")); } @@ -572,6 +567,7 @@ function node_link($type, $node = 0, $main = 0) { if ($type == "system") { menu("node/add", t("create content"), NULL, NULL, 1); + if (user_access("administer nodes")) { menu("admin/node", t("content"), "node_admin", node_help("admin/node")); menu("admin/node/search", t("search"), "node_admin", node_help("admin/node/search"), 8); diff --git a/modules/node/node.module b/modules/node/node.module index b310f070dcc23ebe108a0485f95bba3337118dd2..e7844a37bccd81fc0a054fd14b55169581dde5eb 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -551,17 +551,12 @@ function node_link($type, $node = 0, $main = 0) { $links = array(); - if ($type == "page") { - $links[] = l(t("submit"), "node/add", array("title" => t("Submit or suggest new content."))); - } - if ($type == "node") { if ($node->links) { $links = $node->links; } - if ($main == 1 && $node->teaser && strlen($node->teaser) != strlen($node->body)) - { + if ($main == 1 && $node->teaser && strlen($node->teaser) != strlen($node->body)) { $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read the rest of this posting."), "class" => "read-more")); } @@ -572,6 +567,7 @@ function node_link($type, $node = 0, $main = 0) { if ($type == "system") { menu("node/add", t("create content"), NULL, NULL, 1); + if (user_access("administer nodes")) { menu("admin/node", t("content"), "node_admin", node_help("admin/node")); menu("admin/node/search", t("search"), "node_admin", node_help("admin/node/search"), 8); diff --git a/modules/page.module b/modules/page.module index db19c566f4bfc8439f000ef26869573f2582965b..d8f1934cf9bf52464af4e01eedc42eafa218a17b 100644 --- a/modules/page.module +++ b/modules/page.module @@ -97,7 +97,7 @@ function page_link($type) { if ($type == "system") { if (user_access("maintain static pages")) { - menu("node/add/page", t("static page"), NULL, NULL, 0); + menu("node/add/page", t("static page"), "page_page", NULL, 0); } } diff --git a/modules/page/page.module b/modules/page/page.module index db19c566f4bfc8439f000ef26869573f2582965b..d8f1934cf9bf52464af4e01eedc42eafa218a17b 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -97,7 +97,7 @@ function page_link($type) { if ($type == "system") { if (user_access("maintain static pages")) { - menu("node/add/page", t("static page"), NULL, NULL, 0); + menu("node/add/page", t("static page"), "page_page", NULL, 0); } } diff --git a/modules/poll.module b/modules/poll.module index 1d4680a617ec761209a072d4b29f3758a20b4378..74ca02e8930baab44fbfd05a2d5e8598c6af33b1 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -163,7 +163,7 @@ function poll_link($type, $node = 0, $main) { if ($type == "system") { if (user_access("create polls")) { - menu("node/add/poll",t("poll"), NULL, NULL, 0); + menu("node/add/poll",t("poll"), "poll_page", NULL, 0); } } else if ($type == "page" && user_access("access content")) { diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 1d4680a617ec761209a072d4b29f3758a20b4378..74ca02e8930baab44fbfd05a2d5e8598c6af33b1 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -163,7 +163,7 @@ function poll_link($type, $node = 0, $main) { if ($type == "system") { if (user_access("create polls")) { - menu("node/add/poll",t("poll"), NULL, NULL, 0); + menu("node/add/poll",t("poll"), "poll_page", NULL, 0); } } else if ($type == "page" && user_access("access content")) { diff --git a/modules/story.module b/modules/story.module index 104646ce348195444cdcb65426624480ab7be0d2..51a84fea5586e2d36ba102a35229c34a792a18f2 100644 --- a/modules/story.module +++ b/modules/story.module @@ -56,7 +56,7 @@ function story_link($type) { if ($type == "system") { if (user_access("create stories")) { - menu("node/add/story", t("story"), NULL, NULL, 0); + menu("node/add/story", t("story"), "story_page", NULL, 0); } } diff --git a/modules/story/story.module b/modules/story/story.module index 104646ce348195444cdcb65426624480ab7be0d2..51a84fea5586e2d36ba102a35229c34a792a18f2 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -56,7 +56,7 @@ function story_link($type) { if ($type == "system") { if (user_access("create stories")) { - menu("node/add/story", t("story"), NULL, NULL, 0); + menu("node/add/story", t("story"), "story_page", NULL, 0); } } diff --git a/modules/tracker.module b/modules/tracker.module index ff6f62df493f4aee2b22750ffb1294c411a53907..3c98fa125aa88ea95b1ee572898aa809d056faa0 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -20,7 +20,7 @@ function tracker_link($type) { if ($type == "system") { if (user_access("access content")) { - menu("tracker", t("recent posts"), NULL, NULL, 1); + menu("tracker", t("recent posts"), "tracker_page", NULL, 1); } } diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index ff6f62df493f4aee2b22750ffb1294c411a53907..3c98fa125aa88ea95b1ee572898aa809d056faa0 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -20,7 +20,7 @@ function tracker_link($type) { if ($type == "system") { if (user_access("access content")) { - menu("tracker", t("recent posts"), NULL, NULL, 1); + menu("tracker", t("recent posts"), "tracker_page", NULL, 1); } } diff --git a/modules/user.module b/modules/user.module index 4cd1ed13c1d651739930124ade82fe0f5c3762e4..5e25f4d9d9a3851486c0eb6bec12d9a5cb5c8b15 100644 --- a/modules/user.module +++ b/modules/user.module @@ -466,8 +466,8 @@ function user_link($type) { if ($type == "system") { global $user; if ($user->uid) { - menu("user/edit", t("edit my account"), NULL, NULL, 8); - menu("user/logout", t("log out"), NULL, NULL, 10); + menu("user/edit", t("edit my account"), "user_page", NULL, 8); + menu("user/logout", t("log out"), "user_page", NULL, 10); } if (user_access("administer users")) { menu("admin/user", t("accounts"), "user_admin", user_help("admin/user"), 2); diff --git a/modules/user/user.module b/modules/user/user.module index 4cd1ed13c1d651739930124ade82fe0f5c3762e4..5e25f4d9d9a3851486c0eb6bec12d9a5cb5c8b15 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -466,8 +466,8 @@ function user_link($type) { if ($type == "system") { global $user; if ($user->uid) { - menu("user/edit", t("edit my account"), NULL, NULL, 8); - menu("user/logout", t("log out"), NULL, NULL, 10); + menu("user/edit", t("edit my account"), "user_page", NULL, 8); + menu("user/logout", t("log out"), "user_page", NULL, 10); } if (user_access("administer users")) { menu("admin/user", t("accounts"), "user_admin", user_help("admin/user"), 2);