We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2912
    • 315 Posts
    Hi All,

    I’ve noticed that plugins use events and mroe often than not it attached to the onPagePreRender event.

    I’m wanting to utilise the onBeforeWebLogin event would I be right in thinking I’d need something like this:

    <?php
    $e = &$modx->Event;
    
    if ($e->name == 'OnBeforeWebLogin') {
      // insert relevant code here
    }
    ?>
    


    Thanks all.
      BBloke
      • 26903
      • 1,336 Posts
      Yes, this event is generated from the webloginpe/webloginpe snippets where you also get ’username’, ’userpassword’. Its not generated by the ’core’ as such. Also I think the syntax is $e = $modx->event , not Event.
        Use MODx, or the cat gets it!
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: shamblett at Jan 08, 2009, 09:37 AM

        Yes, this event is generated from the webloginpe/webloginpe snippets where you also get ’username’, ’userpassword’. Its not generated by the ’core’ as such. Also I think the syntax is $e = $modx->event , not Event.
        I think you are mistaken; OnBeforeWebLogin is most certainly used by the core WebLogin snippet as well.
          • 26903
          • 1,336 Posts
          Yes sorry, webloginpe repeated twice above, should read weblogin/webloginpe snippets. What I meant by ’core’ here was stuff under the ’manager’ folder, rather than ’assets’. Can you not elect to not install the weblogin snippet at install time?
            Use MODx, or the cat gets it!
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: shamblett at Jan 08, 2009, 12:35 PM

            Yes sorry, webloginpe repeated twice above, should read weblogin/webloginpe snippets. What I meant by ’core’ here was stuff under the ’manager’ folder, rather than ’assets’. Can you not elect to not install the weblogin snippet at install time?
            You can, but the dependent files are still there in the file-system unless you manually exclude them (i.e. assets/snippets/weblogin/*). In Revolution, no components will be distributed with the core to avoid this situation.
              • 2912
              • 315 Posts
              Thanks guys.

              So weblogin/webloginpe both call the event and I can write a plugin that does something before then final login process. Therefore I’d still need to use either snippet?

              I’m wanting to try and build a bit of a plugin to allow phpBB3 and ModX synchronisation I’m hoping that onBeforeWebLogin fires and runs prior to username and password parse so I can sync the two accounts to maintain password continuity.

              Would this be the best place to start or should I try and code this from a different event?
                BBloke
                • 26903
                • 1,336 Posts
                OK, this has been attempted by others, have a look here http://modxcms.com/forums/index.php?topic=30513.0;wap2, if you searc h the forums for
                phpBB3 there are other threads here that may help you with the integration.
                  Use MODx, or the cat gets it!
                  • 2912
                  • 315 Posts
                  Thanks Shamblett,

                  Thats my starting point smiley I did search and found two threads although I’m trying to think ahead on what I need to look at hence the post.
                    BBloke