We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31037
    • 358 Posts
    As I have some issues with the built-in web user registration, I have created a registration snippet that works on top of eForm.

    This snippet also works well with PPP, so now it’s possible to enable input in PPP tables (and/or any custom tables of your choice) at first registration time.

    If you need to put web user data into database other than what is in web signup snippet, or if you want a user registration without any hard coded js, fixed password length validation or built in error messages, this snippet possible could be of use to you. (If you have no problems with the default websignup snippet there is no need for this snippet.)

    In short:

    * Use all fields in the web_user_attributes table (just add wanted input fields in the form template)
    * Use extra tables (to store data not in default tables) at first register time (works perfectly together with ppp)
    * Use all functionality in eForm to make your own custom validation (and validation messages) and send e-mails (and use other functionality of the eForm snippet)
    * Works with javascript turned off (but adding your own js validation is of course possible)
    * No need to edit the snippet to get your custom web user input into database or change validation messages
    * No name spacing problems when having log in snippet on same page as register form

    Instructions are attached in the zip file.

    Please note that this is a beta version.

    Please note that there could be a problem using dynamic &to parameter in eForm(for sending e-mails to the user registering), this is not an eFreg issue. I have posted a question about that in eForm forum.

    Archive contains:
    - Snippet file
    - Language files (just English and Swedish)
    - Snippet text (to paste into MODx)
    - Form template example (with some eForm validation examples)
    - Documentation

    Parameters list (for full instructions, check documentation)

    &wGroups (Optional)
    Set what web user group(s) you want the web user to be added to at register time, in a comma separated list

    &language (Optional)(Default: english)
    Used for language setting.
    Example: &language=`svenska` (for using Swedish language file)

    &input_prefix (Optional)(Default: empty)
    Set this to the same prefix you have on your input names in the form chunk to or leave empty and use no prefix in the form template.

    &otherTables (Optional)
    Use this for adding data into your own custom tables in the database
    Each table is separated by ";" and parameters per table is separated by ":"

    1:2:3;4

    1. Name of table
    2. Name of table field where you want to store web user id. If the table is created with PPP the key field is named "webuser".
    3. Comma separated list of the fields in the table where you want the input to be inserted
    4. Next table(s) and the parameters for that table

    To let the web user edit his/her data entered in extra tables you could use the PPP snippet.

    Added instructions:

    At this time the name of the submit button must be as in the example form: cmd_signup
    (If that is a problem I can change that limitation in later version of the snippet.)

    New version 08 July 2007: v. 0.2 (beta) [0.1 dl=40]
      • 6726
      • 7,075 Posts
      This is *very* cool, great to have built this on top of eForm smiley

      Thanks I’ll try to give it a test run soon and report !
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 28033
        • 925 Posts
        Awsome, this could be *very* useful for my website. I have a system where I need to give people "Achievements" when they register an account --- this can automate that easily for me.
          My Snippets
          -> PopUpChunk v1.0
          • 31037
          • 358 Posts
          Yes, isn’t it nice to be able to put all needed stuff in database in one shot? laugh

          Please let me know if it works for you, if not I’ll fix it! smiley
            • 28033
            • 925 Posts
            I’m in the process of editing it, but I have a few question (might figure them out on my own as I mess around w/ the script)...

            1) If my custom PPP table is web_user_mysymphonic, I just need to put that in the othertables part of the script call, along w/ the fields it goes with? And in the form, I would just make it efreg_avatar (as an example), and the script would correctly apply it to the mySymphonic table)?

            2) Does this work with the value type=hidden (i.e., I have it set up where people register an account, then apply the IM info, etc. --- I just need an avatar+avatar desc. to make them show up in the Userlist. Also, this is for a basic Achievement I would want to be given at registration)?
              My Snippets
              -> PopUpChunk v1.0
              • 31037
              • 358 Posts
              1. Yes, name the input "efreg_avatar" if you have a field named "avatar" in your table "web_user_mysymphonic". The call would be something like [[efreg? &otherTables=`web_user_mysymphonic:KeyField:avatar` &input_prefix=`efreg_`]] where KeyField would be the field in the table you use as the key (users id).

              The "mapping" is done correctly if you name the input to to the same name as the field in the table (prefixed with "efreg_" in this case).

              2. I can’t see any reason why it should not work with hidden fields.
                • 28033
                • 925 Posts
                Wow...I was thinking it was a lot harder than that. That must have taken a while to code, I’d bet. wink

                I’m planning to test this tomorrow morning, so I’ll let you know if hidden fields work alright (no reason why it shouldn’t, I’d think).
                  My Snippets
                  -> PopUpChunk v1.0
                  • 31037
                  • 358 Posts
                  Actually, the coding it self did not take that long time. What takes time when developing a public snippet is all the stuff needed to do to make it work for many, and trying to figure out what could go wrong when someone is using the snippet.

                  I would say that for me creating a working copy of a snippet (that works for my own needs) is 10 % of the work, the rest is making it user friendly (there should be no need for editing the snippet to change things), writing instructions, testing, testing and testing. I think I created 300-400 users just to test what happens in all thinkable cases.

                  Still, I’m sure there are things I’ve missed so any reports are welcome! smiley

                  And I think I need to rewrite the instructions, eFreg is easy to use but when reading my instructions it could seem a bit complicated. smiley
                    • 33337
                    • 3,975 Posts
                    Nice work Uncle68, your php skills are growing fast wink ... Congratz on that.

                    all the best.
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link
                      • 31037
                      • 358 Posts
                      Thank you Zi!

                      Yes, it was easier to create this snippat compared to PPP, but I’m still a beginner. Also need to try some oo programming, but I think I understand the concept so it shouldn’t be to hard. smiley

                      Have lots of snippet ideas, but the time is limited...