We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27330
    • 884 Posts
    For some reason whenever I save my gallery I must clear the cache for the site to reflect the changes in front end.
    I was hoping I can make a simple plugin which will delete system cache whenever I save a gallery album.
    anyone have an idea how I can do it?
    Thanks in advance...
      • 42562
      • 1,145 Posts
      What is your frontend code to display the gallery, maybe you can call the snippet !uncached?
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 27330
        • 884 Posts
        Thanks @donshakespeare, my snippet is call is indeed cached, the gallery is displayed on a public display screen 24/7/365, So I rather keep caching enabled as default and just force a cache delete when the gallery is saved to push the changes.

        As of now I have added a link to manager dashboard to delete the system cache but its an extra step when can/should be automated.
          • 3749
          • 24,544 Posts
          I don't use the Gallery snippet, but when you save, is it a resource you're saving? If so it should be easy to create a plugin that checks the id of the page and clears the specific Gallery cache if it's the Gallery page.

          If not, I doubt if Gallery fires any System Events that you could attach a plugin to. I could be wrong. If it doesn't you could probably create your own System Event and modify the Gallery code to fire it when you save.
            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
            • 4172
            • 5,888 Posts
            gallery has its own cache-directory and should clear its cache, when saving items
            https://github.com/modxcms/Gallery/blob/develop/core/components/gallery/model/gallery/galitem.class.php#L209

            how do you call the galleries?
            maybe inside nested cached chunks?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!