We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32963
    • 1,732 Posts
    Adam,

    After profiling MODx with Zend Studio I’ve noticed that the QuickEdit plugin is called on ever page view even when it’s not used.

    As a result of this I think I’m going to kind a way to implement contional loading of plugins. By this I mean that a plugin will only be executed if a certain condition is true.

    Example:

    QuickEdit plugin -> OnWebPageInit -> [If user is logged into Manager Interface]


      xWisdom
      www.xwisdomhtml.com
      The fear of the Lord is the beginning of wisdom:
      MODx Co-Founder - Create and do more with less.
      • 33337
      • 3,975 Posts
      Sounds nice to me... (*ahem* .. sorry for getting in Hi-tech discussions tongue )
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I did something along those lines in the TemplateSwitcher plugin, at the beginning it checks for an HTML comment
        <!-- donotswitch -->
        (or something like that, I forget exactly now), and if it finds that comment it simply exits without doing anything. So any template that you don’t want changed (maybe a complex form or something) just add the comment at the beginning of the template’s head.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 22815
          • 1,097 Posts
          Hi. Is this "called everytime" issue possibly something to do with the following oddity:

          Line 37-38 of quickedit.plugin.tpl:
          // Don't do anything if we aren't logged in
          if(!isset($_SESSION['mrgValidated'])) {
          


          It looks to me that this logic is actually only running the plugin if ’mrgValidated’ isn’t set. And given that the ’mgrValidated’ is the session thingie used by MODx, mrg is never set. So the plugin always runs.

          Looks to me that this should be "run if ’mgrValidated’ *is* set", ie:
          if(isset($_SESSION['mgrValidated'])) {
          


          Am I right?
            No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 22303 MODX Staff
            • 10,725 Posts
            Hey Paul; I’m not sure you ever got an answer to this, and I just found this post, but the answer is a resounding, YES, you are correct. WOW. That’s no good. Correcting right now.