We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23383
    • 138 Posts
    I’d like to be mailed when a webuser registrates on my website. I’ve looked on this forum for a solution and find this :
    <?php
    // Set this plugin to listen on "OnWUsrFormSave"
    global $content;
    $e = &$modx->Event;
     
    switch($e->name) {
      case 'OnWUsrFormSave':
        // NOTE:
        //   - You might need to code soemthing to check whether the the event being
        //     called on new user or they are just updating their user information
        //   - I'm not to for sure whether this event being called on web user
        //     signup form snippet included on basic installation of MODx though,
        //     hopefully it is.
        //   - I NEVER TESTED THE SCRIPT, so be careful in using this :D
        mail("[email protected]", "Web User Created", "There is a new web users created!");
        break;
      default:
        break;
    }
    ?>
    


    So I’ve made plugin, and choose "OnWUsrFormSave" event. But when I register a new user, it don’t work.
    So I changed the websignup.inc.php and added to the end of the file :
    $modx->invokeEvent("OnWUsrFormSave");
    

    But it still don’t send mail... I’ve also changed the plugin and the only code now inside is :
    global $content;
    mail("[email protected]", "Web User Created", "There is a new web users created!");
    


    Anyone has an idea ? I wanted to change the weblogin.common.inc.php function webLoginSendNewPassword($email,$uid,$pwd,$ufn)
    and add some php mail inside, but I suppose I will have mail on password lost too...
      • 23383
      • 138 Posts
      Ok, simply because the event was not correct !

      it is "OnWebSaveUser" rather than "OnWUsrFormSave" !