We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24222
    • 63 Posts
    Hi guys,
    i’m a modx newbie... only 2 sites in my portfolio rolleyes

    I follows the snippet code for WebSignup but i don’t understand the meaning of the method
    $modx->invokeEvent

    When i invoke an event with some parameters what’s the result?
    All the plugins registered with the same event will be executed? What else?

    What’s the meaning of this code in websignup.inc.php?
    $modx->invokeEvent("OnWebSaveUser",
    array(
    "mode" => "new",
    "userid" => $key,
    "username" => $username,
    "userpassword" => $password,
    "useremail" => $email,
    "userfullname" => $fullname
    ));
    

    Thanks, and sorry for my poor english... grin
      • 24222
      • 63 Posts
      Anyone can help me? grin
      I have to add additional fields in the signup procedure.

      If I create a new snippet and I associate it to the event, "OnWebSaveUser", will my snippet be executed automatically when in websignup procedure it’s invoked $modx->invokeEvent("OnWebSaveUser") ?

      Thanks


        • 32241
        • 1,495 Posts
        You’ll need to use plugin, instead of snippet. Set the plugin to listen OnWebSaveUser.

        $modx->invokeEvent is use for internal purposes. What it did, it will call all the plugin and necessary code to run, which you won’t be needing this, unless if you replicate the manager to your frontend, other than that, for your purposes, use plugin, and that’s it.

        Hope it helps...

        EDIT: The array being passed on $modx->invokeEvent function is available as local variable for your plugin. Check other plugins and you will understand how to make a good plugin.
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 24222
          • 63 Posts
          Thanks Djamoer,
          so if I want to extend the web signup procedure with additional functions (add fields to the standard web user registration and store the values in a specific table of an external db) I don’t have to touch the original code in websignup.inc but I have only to create my plugin and set it to listen for OnWebSaveUser event.


          This code in websignup snippet...
          $modx->invokeEvent("OnWebSaveUser",array());
          

          ...guarantees that my plugin will be executed each time a new user will be registered. Is it right? shocked
            • 32241
            • 1,495 Posts
            yes indeed..... Try it, if you have any problem, feel free to ask again.
              Wendy Novianto
              [font=Verdana]PT DJAMOER Technology Media
              [font=Verdana]Xituz Media