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

    successfully I created the extended modxUser analog the tutorial in rtfm, with three additional tables. Also I can write into my tables when a user is logged in.
    But how do I write data into my new tables, during registration, eg. with the Login-Component?
    I guess the bestway is to use a posthook, but how to identify the new user id and write the data to my tables?

    Thanks for your help.

    Greetings
    Florian
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The Register snippet will provide some objects for its post-hooks
      // A reference to the modUser object
      $user = $hook->getValue('register.user');
      // A reference to the modUserProfile object
      $profile = $hook->getValue('register.profile');
      // An array of usergroup names that the User joined
      $usergroups = $hook->getValue('register.usergroups');

      http://rtfm.modx.com/extras/revo/login/login.tutorials/login.using-pre-and-post-hooks
        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Apparently you can also use the user's fields...
        $message = 'Hi, a new User signed up: '.$hook->getValue('username')
         . ' with email '.$hook->getValue('email').'.';
          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
          • 23496
          • 20 Posts
          Hi Susan,

          thanks, that is it, where I am looking for...

          Have a nice day
          Greetings
          Florian