How to prevent node delete for a specific node? I want to prevent a specific node from being deleted by anyone except admin. For this specific bundle there are two roles that have full access to the node: admin and manager. A manager can delete any nodes of this content type, but I want one specific node to be locked.

I tried hook_node_delete and it does not work as the delete hook for the specific content type (node) has already run by then.

I tried the Content Access module and setting of permissions per node, but then when I go to the specific node's edit page the 'delete this content' for the role manager is enabled and greyed out.

I also do not want to just remove the action from the edit form as the node can be deleted in a view bulk operation. Hence I need a catch all solution.
I don't think there's a catch all solution.



On second though, you maybe can create a new content type, say node2, and set the permissions for that content type to admin only.

and if you will ever need more than one admin-only node, you'll have no problems at all.

however i have no experience whatsoever there :p



in hook_menu_alter change the 'access callback' for the "node/%nid/delete", since you need it only for a particular node ( say nid=120)

$items['node/120/delete'] = $items['node/%nid/delete'];
$items['node/120/delete']['access callback'] = 'custom_function';
unset($items['node/120/delete']['access arguments']);


this will prevent that node to be deleted directly.

then you need to remove the delete button from that node form edit (however i don't know the form name).

this should be enough and prevent the deletion "nicely", but you can use hook_delete like pointed out in the other answer to catch everything and everything else that can't be prevented like that.