Rules module: How do I execute code just before content is deleted? I'm trying to execute some code right before content is deleted. The Rules module has events for


After updating existing content
Before saving content
After saving new content
After deleting content


However, none of these execute my code at the right time. Is there a way to easily add new events? If so, where should I hook? My knowledge of the Drupal core is very small.

Background:

What I'm doing is updating a menu link that links to the content in the database, but as the update code only runs after having deleted the content, there isn't any row to be updated because Drupal apparently deletes menu items that link to non-existent content.
You might be looking to implement hook_delete().

You can also check node_delete_multiple() in node.module, if you want to have an idea of what Drupal core does when it delete nodes...there's other hooks that get called as well.