diff --git a/includes/menu.inc b/includes/menu.inc index 4a79861b815..b979275110d 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1880,7 +1880,7 @@ function menu_navigation_links($menu_name, $level = 0) { $router_item = menu_get_item(); $links = array(); foreach ($tree as $item) { - if (!$item['link']['hidden']) { + if ($item['link']['access'] && !$item['link']['hidden']) { $class = ''; $l = $item['link']['localized_options']; $l['href'] = $item['link']['href']; diff --git a/modules/menu/menu.test b/modules/menu/menu.test index 7a92a2f261b..e1a7f3fbfe4 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -294,6 +294,27 @@ class MenuTestCase extends DrupalWebTestCase { $this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.'); } + /** + * Tries to use the navigation menu as the source for secondary links. + */ + function testNavigationAsSecondaryMenu() { + $this->drupalLogin($this->big_user); + + // Go to the menu settings page and make the navigation the source for the + // secondary menu. + $edit = array( + 'menu_main_links_source' => 'main-menu', + 'menu_secondary_links_source' => 'navigation', + ); + $this->drupalGet('admin/structure/menu/settings'); + $this->drupalPost(NULL, $edit, t('Save configuration')); + + // Now visit the user page. There should be an 'Add content' link in the + // navigation block and one in the secondary menu. + $this->drupalGet('user'); + $this->assertNoUniqueText(t('Add content')); + } + /** * Add a menu link using the menu module UI. *