We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    If you want to use the MODx security system, here’s some snippet code for inserting basic info into the web_users and web_users_attributes table as well as assigning the user to a group. The user is created blocked, so it requires manager intervention in the Security->Web Users page to approve/validate the user. At that point a new password can be assigned/generated and the notification sent to the user. The notification message in the manager’s language file can be modified to suit.
    <?php
    function addNewUser($form) {
        global $modx;
        $groupid = 1; // id of the group you want to assign the user to
        // create user using email as username
        // can use a username form field instead if desired
        $table = $modx->getFullTableName('web_users');
        $fields = array('username' => $form['frEmail'],
                                'password' => $form['frLastname']
                                );
        $modx->db->insert($fields,$table);
        $uid = $modx->db->getInsertId();
        // add user attributes
        $table = $modx->getFullTableName('web_user_attributes');
        $fields = array('internalKey'    => $uid,
                'fullname'    => $form['frFirstame'] . ' ' . $form['frLastname'],
                'email'    => $form['frEmail'],
                'phone'    => $form['frPhone'],
                'blocked'    => 1,
                'gender'    => $form['frGender'],
                'country'    => $form['frCountry'],
                'state'    => $form['frState'],
                'zip'    => $form['frZip'],
                );
        $modx->db->insert($fields, $table);
        // add user to group
        $table =  $modx->getFullTableName('web_groups');
        $fields = array('webgroup' => $groupid,
                                'webuser' => $uid
                               );
        $modx->db->insert($fields,$table);
    
    return;
    }
    ?>
      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
      • 5340
      • 1,624 Posts
      Quote from: mrhaw at Jul 13, 2010, 03:41 PM

      THANK YOU! cool

      Are you going to make a tutorial of your custom web-user registration? wink

      Not sure.
      I just used eForm with something similar to what Susan posted above.
      The Edit Profile part was accomplished with eForm and eForm events.
      For login/logout I used the WebLogin snippet
        • 20413
        • 2,877 Posts
        Thank you both! smiley

        I use custom fields for my web-users, that they can control with eForm2db front-end.
        As for now I do this manually (dbEdit module) for each user/usergroup(!)

        What I plan to do, is make the WebSignup snippet right away
        (also) save the username to a row with id in my custom table.

        So I can have my web-users to work with their data dynamically. And ditch a road
        where each and every user must have their own usergroup. As I’ve been
        restricting resources/documents. The win: Smaller cache file! smiley
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 4385
          • 372 Posts
          Quote from: maclonghorn at Jul 07, 2010, 12:43 PM

          trying to setup a basic event registration page. so essentially, user will "sign up" by entering their email, contact info, and the data is written to a table so that MODx admin can go in and export a list of people who’ve signed up. i looked into using eForm, but it doesn’t store data, just emails it so i wouldn’t be able to get a list of signups. i also looked into webloginpe, but i don’t want to track "web user" registration b/c it’s not necessary for the person to be recognized next time they sign up for an event.

          has anyone done event registration before? i thought there was a snippet or plugin that would do it but i couldn’t find one. if not, any suggestions on how i might do this without using a 3rd party like constant contact?

          thanks.

          Have you looked into EventBrite? http://www.eventbrite.com/

          Pricing based on ticket price, so if you have free events, there are no costs. Lost of ways to integrate into your site.

            DropboxUploader -- Upload files to a Dropbox account.
            DIG -- Dynamic Image Generator
            gus -- Google URL Shortener
            makeQR -- Uses google chart api to make QR codes.
            MODxTweeter -- Update your twitter status on publish.