We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44273
    • 3 Posts
    Hello,
    I am trying to do a POST call to my webhook when a new Resource is published.

    I made my own plugin that does all the logic, I fire the plugin OnDocFormSave and OnDocPublished. Everythink works fine, but the plugin is not fired when a Publish date is set.

    I read this topic:
    https://forums.modx.com/thread/?thread=44201&i=1

    But still I cannot make it work. The topic is also over 7 years old. Is there a new way to fire an event every time a new Resource is published (through administration or with the Publish date set)?
      • 46886
      • 1,154 Posts
      Did you build in error messages in your snippet? I think its more likely the snippet is firing but failing somehow rather than the events not firing, or maybe the snippet is not properly set up to fire on the event.

      Also some code would help
        • 44273
        • 3 Posts
        Well the problem is OnDocFormSave is fired only when the document is saved via the admin, as the documentation says.
        "Fires after a Resource is saved in the manager via the editing form."

        And the same for OnDocPublished.
        "Called when a Resource is published via the Publish context menu."

        But when you set the time to Publish a document in the future (eg tomorrow), these events are not fired up.

        I tested with sending a simple message every time you save a document, then every time you publish one. The Publish is not sending anything when I set the Publish date.


        There is nothing to show really. I am just sending a curl JSON request to my Discord webhook.
          • 3749
          • 24,544 Posts
          I looked at the code in the modRequest class where this happens and it does not fire OnDocPublished, nor does it call the publish processor, which would fire that event. It should definitely do one or the other.

          Could you file that as a feature request here: https://github.com/modxcms/revolution/issues
            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