0

Could any one give me some ideas on what i need to check please?

I wish i could just show the site, but of course it' for my company, so I can't, but I have a menu bar at top of my page home, contact, meet the authors, books;

Under "Meet the authors", i have several authors, I created an authors content type and have one for each author. When you hover over "Meet the Authors" you see the drop-down list/sub-menus of the authors - only five of them now.

so using panels and views, when you click of "meet the authors" you see a list of the authors on the page and can click in for more detail.

Using the access control module, I only want this link to appear for anonymous users, once logged-in, this link should disappear but the link will not hide itself after login, but here is what's really odd, the sub-links which are the authors, those links/sub-menu do/does hide when the user logs in and only displays for the anonymous user

so for example, this enable menu should appear for the anonymous user

Meet the authors - ----Kim Fields - ----Tony Bruewer - ----Harris Carlton - ----John Brown

and should be completely hidden for the authenticated user, but what is happening though, upon login, the user sees the parent menu: Meet the authors

but the sub menus have hidden themselves as they should, i just can't get the parent menu to hide itself.

I have checked the access control to make sure I have selected things properly. I even created test content type and menus to test and everything worked, so I assume there is something different, but I just can't see what and where.

Any ideas and guidance would be greatly appreciated. Thank you.

Notes: the parent menu about [Meet the authors] is pointing to a panel page that contains a view to display the list of authors. I do not have access setting on the panel.

More Information: So for my own sanity, I slowly created another content type, a view for that content type and a panel page. Saved, cleared cache, ran cron. Change settings in control access module. Here is what I now see-- The sub-menus of the parent menu [Meet the authors]are following the authentication rule, the top menu just displays all the time. I create this mention from the Structure->Menus navigation. So the top menu item is pointing to the panel whereas the sub-menu items are actually the content types.

Still more Info: Here is what I think the issue that I still have not found a way around. I create the view, create the panel, place the view in the panel, give the panel page a normal menu entry. So that is my menu item that appears. If I click on that top parent link, it takes me to the panel with my view, but the menu item won't display/hide as needed. So i realized that the menu I am creating in the panel has nothing to do with the content type and the content type is needed to manage the access control module. So I go into my content type, change one of it's types and change the menu to point to the panel url I created. Well when I do that, that url is assigned to that content type node, not panel, but the menu item does, now, display/hide based on the selection from the access control module.

Can anyone give me a way around this? What i think I need is a way to point one of my node content types to the panel. Does this make sense. I love Drupal, but sometimes...

2
  • what happens if you click on the parent item? i.e. is the access control actually working to restrict access to the page.
    – Geoff
    Sep 7, 2014 at 16:04
  • Hi Geoff - see the "still more info" note i added above. Sep 7, 2014 at 19:45

2 Answers 2

0

The easiest way with the least amount of programming would be do it with css:

body.logged-in .my-menu-name-or-css-class {
  display:none; 
}

The most standards compliant way would be to use hook_menu_alter and unset the menu if $user->uid returns true: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu_alter/7

However, in this case you're probably looking at maybe saving 10kb of bandwidth by unsetting the menu vs. just using CSS to hide it.

0

Ok, i finally resolved this issue, or figured out what is going on. This is a very specific issue, so posting my solution here, should someone else run into this exact problem.

Ok, so I am using panels in my sites, inside the panels, i have views based on the content types. My top level/parent menu item is pointing to the Panel that holds the View.

The menu item is NOT a menu created of/from the content type consequently, the "control access module" didn't do anything with the menu item, because it does not consider it a content type and that is actually correct.

So you know the saying "there's a module for that" -- there is a menu_per_role module that allowed me to update visibility based on user role, so I could hide that menu for the authenticated user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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