We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37054
    • 93 Posts
    I see from the documentation and some testing that onDocFormDelete runs if I delete a resource using the delete button in the resource edit form and also if I right click a resource in the site tree.

    So my question is, when does onResourceDelete fire? I couldn't seem to catch it and I note that it's not listed in the manual as a system event at all though it is in the plugin creation/editing forms.
      • 3749
      • 24,544 Posts
      It fires in two places, the resource/update processor and the resource/delete processor.

      core\model\modx\processors\resource\update.class.php
      core\model\modx\processors\resource\delete.class.php

      If by "manual" you are referring to my book, I don't think that event existed at the time it was written.

      FYI, that event fires when a resource is marked for deletion, not when it is actually removed from the DB. A resource marked for deletion can be undeleted and is only removed from the DB when you click on trash can icon at the top of the Resource Tree.

      If you want to catch resources when they are actually removed from the DB, there's OnBeforeEmptyTrash and OnEmptyTrash.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting