We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38878
    • 255 Posts
    I have created a posthook in the register snippet to add a contact to sugarcrm via the rest api and all is working as expected. But, after implementing it occured to me that the submission to the crm would be better to call his posthook on the confirmregister snippet instead (mostly by preventing invalid contacts with bad email addies).

    I understand the confirmregister snippet basically just "activates" the user account. After looking into the confirmregister controller it looks like the code would need some mods to pass the user profile data into posthook. Was just wondering if anyone has tackled this as I haven't seen mention in the roadmap for login.

    This question has been answered by harveyev. See the first response.

      • 3749
      • 24,544 Posts
      I could be wrong, but I think everything in the Login package will take hooks already (which are really postHooks). IIRC, they all extend the LoginController class.
        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
        • 38878
        • 255 Posts
        Thanks Bob. I'll just try it and see.
          • 3749
          • 24,544 Posts
          Let us know if it works. wink
            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
          • discuss.answer
            • 38878
            • 255 Posts
            Well, after looking through the confirmRegister docs, I decided to write a plugin to run against the onUserActivate event which is fired after the confirmregister snippet completes. Really minor change to the original posthook I wrote to make it a plugin and grab the profile information for the user object that gets passed to the onUserActivate event. All in all was easy peasy lemon squeezy and IMO the correct way to populate only "validated" contact data into other systems. At least I know the email info is correct.

            Thanks much for the assistance!