I have created two node-types: 'match' and 'set'. When a 'match' node is viewed it displays a listing of several 'set' nodes. I've acheived this by calling node_load_multiple in hook_node_view. That's all 'set' nodes do: they are listed by a match node. 'Set' nodes can be created, edited and deleted, but I only want the user to be able to view them in listings.

So, I want to deny access to viewing 'set' nodes on their own page at node/1 or whatever. I've denied access to 'set' nodes using the node access mechanism, but then they don't appear in my listing either.

How can I set these nodes so that they can only be viewed in my listing?

The only thing I can think of is not to call node_load_multiple but to write by own db_select query to retrieve all the necessary 'set' nodes to list in a match 'node': a bit messy.

Hope this makes sense. I open to any suggestions. Thanks.

  • I'm 100% certain this question has been asked before, though I can't find it ATM. Page manager can hide content types for you. So can Rabbit Hole, but I strongly dislike that type of "single use" modules, so I don't recommend it.
    – Letharion
    Commented Jan 8, 2014 at 22:44
  • I agree about using modules to do one task, if, with a bit of effort, you can write a few lines of code to do the same. However, Rabbit Hole sounds perfect. The other options seem to involve bypassing the node module. I like the 'unpublish the node' idea. I could do this and the then write my own db query. Thanks for the ideas!
    – dbj44
    Commented Jan 8, 2014 at 23:53

1 Answer 1


I believe you could use the node_view hook. In that hook you can check for the node type (set) and view mode (full) and add your logic. If you're using a reference field to relate the set to the match then you could probably redirect the user back to the match.

When you're listing sets on the match page you could also not render them as links a user doesn't try to view the set directly.

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