We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1113
    • 11 Posts
    Hi everyone.
    I have yet another one trouble with my MODx website. This time with the plugins: TVImageResizer from Andchir and EditArea plugin. Both of them are totally not working. And I think that the problem is in the call by event.
    If you don't know: TVImageResizer is a plugin to resize images selected as TV's of document. It's called on the event 'onBeforeDocFormSave'.
    I've tried to modify the code inserting
    $modx->webAlert("!!!");

    just after the
    if ($e->name == 'OnBeforeDocFormSave')

    i.e. in the beginning of plugin main code, but it also doesn't show anything. It looks like plugin just passing by the binded event.

    And maybe EditArea acts the same, but it's not such important plugin as TVImageResizer. Without the last one all works on my online store are paralized! Help!!!
      • 3749
      • 24,544 Posts
      If the plugin is only responding to one system event, you can just remove the if() statement. It's unnecessary.

      If you need to identify the event, the code for Revo looks like this now (I suspect the same change was made for Evo, but I'm not sure):

      if ($modx->event->name == 'OnWhatever') {
      }


      [ed. note: BobRay last edited this post 14 years, 11 months ago.]
        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        The event identification code should look somethig like this
        $e =& $modx->event;
        switch ($e->name ) {
            case 'OnStripAlias':
                ...
        

        Or if a one-liner:
        & $modx->event->name == 'blah'
          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
          • 1113
          • 11 Posts
          Tried to remove "if" statement (plugin is responding only to OnBeforDocFormSave) - no changes.

          @Sotwell: yes, the event identification is the same as you said.
          $e = &$modx->Event;
          
          if ($e->name == 'OnBeforeDocFormSave')
          {
          ...
          };
          


          Also I made a test plugin with webAlert() responding to OnBeforeDocFormSave event.
          $modx->webAlert("!!!");
          


          Still no results...
          What's wrong with event detection in my MODx??? (Evolution 1.0.5)

          At the same time PHx functioning perfectly.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I have no idea; that plugin works just fine when I try it. Are you sure you have the correct System Event checked?

            Try disabling the PHx plugin and see what happens; although it shouldn't have any effect at all in this case I have had too many bad experiences when using it.

            Do you have any other plugins using that event? Maybe you need to re-arrange the order of the plugin execution?
              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
              • 3749
              • 24,544 Posts
              Instead of webAlert() (which I think may be gone), try this:

              die('!!!');


              Make sure the plugin is not disabled.

              And you definitely don't need the if statement (but don't forget to remove the matching curly brace at the end of it).

              Plugins with a syntax error will often just hang, so pasting the code into a good code editor is always a useful check.

              I have plugin debugging code for Revo that writes debug output to a chunk called "debug" but I'm not sure what it would look like in Evo.

              If die() shows that the plugin is executing, feel free to post your plugin code here.
                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
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                webAlert worked fine for me; I got a popup with !!! when I tried the single line exactly as written.
                  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
                  • 3749
                  • 24,544 Posts
                  Hmmmm . . . the last time I tried it in Evo (and Revo) nothing happened. Maybe I had popups blocked in my browser.
                    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
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Hmm. Odd indeed; I have popups blocked in my Firefox as well...
                      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
                      • 3749
                      • 24,544 Posts
                      Hmm. I just tried it in a snippet in MODX 1.0.0 and got nothing with FF 3.6.12. Browser JS security settings?
                        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