We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1828
    • 137 Posts
    I need to pass a web user group to the websignup snippet via another snippet call, like so:

    [!WebSignup? &groups=`[[GetGroup]]` &tpl=`RegistrationForm`!]


    However, it doesn’t appear to work and the user does not get associated with any groups. (The GetGroup snippet does output the correct string.)

    I am guessing that WebSignup doesn’t accept snippet calls in a parameter. Is this correct and, if so, what can be done about it?

    Any ideas would be welcomed!

    Thanks,
    Anton
      • 32982
      • 674 Posts
      could be isent cacheable [[XXXX]]
      test [!xxxx!]
      hi
        Jabiertxof (formerly XYZVISUAL)
        My bussines: http://marker.es
        https://www.youtube.com/user/jabiertxof/videos
        • 1828
        • 137 Posts
        Thanks for the suggestion.

        I tried this:

        [!WebSignup? &groups=`[!GetGroup!]` &tpl=`RegistrationForm`!]


        which resulted in the WebSignup snippet call not being correctly parsed. The bit after "[!WebSignup? &groups=`[!GetGroup!]`" was echoed on the webpage.

        Then I tried this:
        [[WebSignup? &groups=`[!GetGroup!]` &tpl=`RegistrationForm`]]


        which resulted in the original problem, of the user not being assigned to any group.

        Any more suggestions would be appreciated!

        Thanks,
        Anton
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I think if the outer snippet is uncached and the inner snippet is cached it might work. Considering how the parser works, all cached snippets are parsed in the first pass, while uncached snippets get cached in subsequent passes. This way, the inner snippet gets evaluated, then the outer snippet gets parsed with the value of the inner uncached snippet already done. As long as the "GetGroup" snippet actually returns the value, it should work.

          Another way would be to have the GetGroup snippet set placeholders, call it first, then call the login snippet and use the placeholder.
            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
            • 26435
            • 1,193 Posts
            Anton, how does your snippet aquire and then pass the value of the group.
            would it be easier to just put the group choice in a form and then use

            return $_POST[’group’];

            as the content of your [[GetGroup]] snippet?

            p.s. I have never had a snippet function correctly when calling another snippet uncached as one of it’s parameters.
              Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
              All of the above... in no specific order.


              I send pointless little messages
              • 1828
              • 137 Posts
              It turns out that the error was all mine and far more simple than a nested snippet call issue. It’s been a while since I last worked with web forms and I had forgotten that querystring params ’disappear’ when forms are submitted, unless they are otherwise persisted. rolleyes Simple changes to the form and to my GetGroup snippet fixed the trouble. And yes, the nested call works fine when it is cached and the outer snippet is uncached.

              Thanks for the help and sorry for wasting your time! tongue