This question already has an answer here:
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
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.