We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10208 ☆ A M B ☆
    • 1,780 Posts
    Default User Groups works perfectly fine when creating new user in the mange,r but not from the front end.

    I tried enabling it on the OnUserActivate system event, and created a new user in the front end. No good.

    I actually only need it for new front end users.
      Frogabog- MODX Websites in Portland Oregon
      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
      Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      I suspect Bob would normally answer this, but I haven't seen him post lately. Does anyone else have an idea what could be wrong?
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 3749
        • 24,544 Posts
        I've been really busy getting ready for MODXpo. I think the problem may be that, as you've guessed, what you're using to create the user doesn't trigger the event that DefaultUserGroup is listening for.

        Try connecting it to OnUserSave.

        What are you using to create the users?

        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        MODX info for everyone: http://bobsguides.com/modx.html
          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
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          Rats... OnUserSave and OnUserActivate don't work.

          I'm using Subscribe with Login, with plans to implement one of the mailing extras for a newsletter or notification/contact depending on other interests. It works fine, other than the default user group.

          Thank you for your time Bob. Much appreciated.
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 3749
            • 24,544 Posts
            There's probably some reason why I didn't use OnUserSave to begin with, though I can't remember what it is.

            The Subscribe snippet actually acts as a posthook for Register, so you should be able to use the &usergroups property in the Register tag of the sbsRegisterFormTpl Tpl chunk.

            IIRC, the format is:

                &usergroups=`usergroup1:rolename,usergroup2:rolename`


            The role is optional, so it could also be:

                &usergroups=`usergroup1,usergroup2`


            or just:

                &usergroups=`usergroupname`


            By default, it puts all users in the Subscribers group with a role of Subscriber.


            ------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using.
            MODX info for everyone: http://bobsguides.com/modx.html
              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
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              From what I've seen, the front-end snippets for user registration as well as profile editing don't use events, they use pre- and postHooks.

              postHooks A comma-separated list of 'hooks', or Snippets, that will be executed after the user's profile is updated.

              postHooks A comma-separated list of 'hooks', or Snippets, that will be executed after the user is registered.
                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
                • 10208 ☆ A M B ☆
                • 1,780 Posts
                IMaybe that's why I failed?

                Tried to post this last night, but the forum was in time out again.

                Such a naughty forum...
                ************************************
                Argh! No workie...

                Subscribers:Subscriber works, but beyond that nothing. I tried changing the user group name to have no spaces, re-configured defaultUserGroup to match... nothing.

                So, after I wrote the above I thought I'd try replacing the Subscribers:Subscriber with just one user group (I was trying to default two) and completely removed Subscribers from the snippet.

                Interesting result... it subscribed a new user to Subscribers! (but not the user group that I specified).

                So, where else is it getting the Subscribers:Subscriber from now?

                Darn trolls!
                  Frogabog- MODX Websites in Portland Oregon
                  "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                  Having server issues? These guys have MODX Hosting perfected - SkyToaster
                  • 3749
                  • 24,544 Posts
                  Subscribe itself doesn't set any user groups at all. The only setting for that is in the sbsregisterformtpl chunk. The Register snippet sets the groups and the tag for it is in that chunk. The chunk is specified on the Subscribe register page and it's cached, so maybe you're seeing an old version?

                  BTW, if you're specifying both a role and a group, both the role and the group have to exist (and be spelled correctly -- they're case-sensitive).



                  ------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using.
                  MODX info for everyone: http://bobsguides.com/modx.html





                    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
                    • 10208 ☆ A M B ☆
                    • 1,780 Posts
                    OK, phew. Figured it out. I'd duplicated all the chunks including the sbsRegisterFormTpl and set it to be called on the register page at initial setup. Of course, since my prefix for this particular site is sbsnw, and often is referred to in real life as simply SBS, I missed that the page was calling sbsnwRegisterFormTpl instead of sbsRegisterFormTpl.

                    I was modifying the wrong chunk. Again... duh.

                    I knew this sbs stuff was gonna get me on this site once I saw the prefix names associated with it. Too similar!

                    I haven't even tested it, I just know it's gonna work since I now know why it's been using Subscribers:subscriber.
                      Frogabog- MODX Websites in Portland Oregon
                      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                      Having server issues? These guys have MODX Hosting perfected - SkyToaster
                      • 3749
                      • 24,544 Posts
                      Been there a million times. wink

                      I hesitated to use those prefixes, but just calling it RegisterFormTpl seemed too prone to collisions.


                      ------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using.
                      MODX info for everyone: http://bobsguides.com/modx.html
                        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