0

I want to hide a node from our site for users with a specific role. I.e I have a section of my site that should only be accessed by logged in users, and I want to hide the node and the link to it in the main menu for anonymous users.

This seems like a very easy task but I'm having a hard time finding an easy way of doing this. I'm using Drupal 7.

-I've tried to do it with Rules but have not succeeded, (main problem has to do with not getting any relevant selections to choose from in the data selection.)

-I'v tried to create a new context in Context and everything looks good, but it has not the desired effect.

Is there a module for this? Something like the equivalent of node access since it is not developed anymore.

0

Surely you can easily do it by using roles.

Create a role for the users you want to be able to access the node type. in /admin/people/permissions set the permissions for the roles - disallow access to the node type for roles apart from your specific role that should be able to access it.

For the menu simply create a copy of your menu with the link you wish to hide for other roles and show it only for your specific role and hide the other menu instead. Since you usually assign menus as blocks this can be easily done.

| improve this answer | |
  • 1
    Under nodes section in Roles I can only see options for "edit" or "delete" or possibly "create" nodes under the nodetypes. The "view" node option is not there from what I can see. I really don't want to mess too much with the menu since I have not built it and it's quite complex. Also there should be a better solution than to create double menu items. From what I understand when you unpublish a node it will also dissapear from the menu. So is there a way to publish a node on login and then unpublish it as well on logout? Or is there a better way to do it? – Math Jul 20 '12 at 11:11
  • Sorry, you are right. Maybe look at drupal.org/project/content_access - it has a d7 release. – tecjam Jul 20 '12 at 11:25
  • Thanks! Is there any other module worth looking at that can do this, as I have not succeeded to get content access to work on my site? Very weird. – Math Jul 21 '12 at 11:05
0

I solved my case by using the Taxonomy Access Control Lite module.

This node_access module governs access to nodes based on the taxonomy terms applied to the nodes. A simple scheme based on taxonomy, roles and users controls which content is visible.

As the name implies, this module shares some functionality with an earlier module called Taxonomy Access Control (TAC). If you are shopping around for an access control module to use, consider that one as well. See this module's README.txt for an explanation of "why yet another access control module".

| improve this answer | |

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.