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
    A snippet for simple user registration, suitable for a newsletter registration for example. The form accepts an email address. The snippet checks if this address is already in use. If it is, it checks to see if the user with that email address is already a member of the group specified in the snippet argument (a valid web user group is required, otherwise the form will not be displayed). If the user already is a member, a message to that effect is returned. If not, the user is added to the group, and if the options were set in the snippet call, email notification is sent to the admin and/or the user.

    If the email address is not in use, a new web user is created with the email address as username and a random password. The user is added to the group, and email is sent if the options were specified. This user can be activated as a normal user by the admin simply by giving the user a new, known password.

    If the "remove" button was selected, the snippet checks the group for that user. If the user is not a member of the group, it simply returns the form as usual. If the user is a member of the group, he is removed from the group and mail is sent, as with registration. An appropriate message is returned. The user is not removed from Web Users.

    Many thanks to xwisdom for the eform snippet, I "borrowed" your sendmail function for this!

    As it is, an admin will need to check the web group for a list of registered users, and do whatever with them.

    Future versions will add features, such as optional validation email for double opt-in/opt-out, optional removal of the user altogether on opt-out, and a bridge to (probably) phpList using a corresponding plugin. But I do want to keep it a simple, modular registration snippet that can, in the best MODx tradition, be used for any number of features that require a simple registration.

    UPDATE
    fixed a bug where an unregistered existing web user would get registered even if the "unregister" box was ticked.
      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
      • 32963
      • 1,732 Posts
      Very nice snippet Susan smiley I also like the idea of email confirmation
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 33337
        • 3,975 Posts
        Very nice snippet Susan! smiley

        Thanks for sharing.

        regards,

        zi
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 6726
          • 7,075 Posts
          Waow this is way cool, great snippet Susan !!!
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 17058
            • 80 Posts
            Thanks Susan, for this nice snippet.
            I slipped over from this thread:http://modxcms.com/forums/index.php/topic,2421.75.html Newsletter (Improved version from Luca Allulli).
            that’s why i got some questions (because i did’nt work fine):

            It is neccesary to setup the newsletter snippet or works RegisterX as a stand-alone snippet?
            the call is: [[RegisterX&usergroup=`NewsletterUserGroup`&sendadmin=`[email protected]`& senduser=`1`]], right?
            where i have to setup the usergroup=`NewsletterUserGroup`? (manage users, role management, manager/web permissions).

            thanks, le block
              le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              This is a stand-alone snippet that has no relation to the newsletter snippet. I don’t ever intend to have it be anything but exactly what it is right now. Well, I do plan to add a few more advanced features to it, like a double-opt-in email verification system. But it’s really not intended for any one purpose; use it to "register" web users into the specified web user group for any purpose you want.

              All you need is a web user group with the name you specify in the snippet call, that’s all.

              I do intend to make a plugin/module to hook the MODx user system to phpList one of these days, but it will be a separate module that can be configured to use the appropriate web user group as its mailing list.

                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
                • 17058
                • 80 Posts
                Nope, it doesn’nt work yet.
                I did the setup step-by-step again and created a web user group (tab web-permissions).
                No inputfield is shown.

                is it possible to send you a PM with a temporarely account a you have a check?
                le block
                  le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  But of course. I’ll be glad to take a look.
                    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
                    I’m sorry, I didn’t notice in your snippet call, but the first argument must start with a ?, just like a URL query string!

                    Plus, a dynamic snippet such as a form always needs to be called uncached in a cached page, or else you’ll never see the difference when the user submits the form.

                    [!RegisterX?usergroup=`NewsletterUserGroup`&sendadmin=`[email protected]`& senduser=`1`!]
                    


                      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
                      • 17058
                      • 80 Posts
                      It works superb!
                      I allways mess with the snippet calls [[ or [!. But I will learn this. smiley
                      There are two last questions on this issue.
                      1.) where to find the (css)style for #nlxForm? (wanna remove the bounding borders)
                      2.) Maybe you have seen, i’ve got to calls (index-page and id=41). is it possible (with a little coding help of you cool ) to modify the call at the startsite in this way, that only a inputfield appears and any user-interaction will be on a redirected (&gotoID=41) site?

                      Again and again, thanks a lot.
                      le block
                        le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign