We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16610
    • 634 Posts
    Trying to solve this annoying little bug with temporary solution: http://modxcms.com/bugs/task/635?histring=quickedit&tasks=last

    Longer explanation by Cassiel: "According to my tests, the <quickedit:content /> tag is added to the cached version of the document if the first call to the document (outside the manager) is made by a QuickEdit enabled session, meaning you’re logged in the manager (in another browser tab/window). If you log out before calling the document for the first time (outside the manager), there won’t be any extra tags added."

    Easy solution with a tiny plugin:

    //check if user is not logged in manager
    if(!isset($_SESSION['mgrValidated'])) {
        $modx->documentOutput=preg_replace('/<quickedit:[^>]*>/', '', $modx->documentOutput);
    }
    
    // Template Service Events: OnWebPagePrerender
    


    My question is...

    Can I do this same plugin with Template Service Event OnBeforeSaveWebPageCache?

    That way the plugin would only replace unwanted tags when user is logged in manager and page is to be saved to cache.

    But what about the code? Something like...

    //check if user has logged in manager
    if(isset($_SESSION['mgrValidated'])) {
        $modx->Something???=preg_replace('/<quickedit:[^>]*>/', '', $modx->Something???);
    }


    Can someone give me an advice how to deal with caching or is it that simple at all?
      Mikko Lammi, Owner at Maagit
      • 16610
      • 634 Posts
      Answering to myself: Lesson learned, this won’t obviously work because replacing <quickedit:xxx /> tags compleately hides them also from manager users when retrieving documents from cache.
        Mikko Lammi, Owner at Maagit