How can I prevent a node from listing, programmatically? I want to select node by nid. Beacause of some reasons, I don't want to use hook_node_grants() and hook_node_access_records()

I tried to change the _node_access_where_sql() function in the core which creates where clause for use in fetching node listings but $node or $nid is not passed to the function so I can't select node by nid

  • Where do you want to stop this content being listed? In the standard content listing? It's a REALLY REALLY bad idea to be hacking core... – Chapabu Nov 22 '11 at 22:21
  • Can you tell us more about what you want to achieve? – BetaRide Dec 23 '11 at 8:34

Have you tried simply unpublishing the node with Rules? Rules will allow you to programmatically unpublish content based on a variety of factors. Once unpublished, Drupal will not list the node in content with the exception of Views that are not set to only display published content.

What are you using to determine which nodes should be processed by your code?

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.