We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10405
    • 288 Posts
    Hi, I have a resource set up with three Login snippet calls, so that three different groups of users can log in and be sent to their respective welcome pages, based on which user group they're in. I've set up my resource groups and user groups, given them membership and that's all fine. The problem is that for some reason MODx doesn't like there being three login boxes on the same page. I tried setting them up as a chunk and as a TV, and even separate chunks, but the same thing happens. Everyone gets redirected to the welcome page for the first user group (although the 2 other groups get redirected to the error page clearly, as they're not members)

    How can I make multiple login forms work on the same resource?

    This is the current code:

    [[!Login? &loginTpl=`lgnLoginTpl` &logoutTpl=`lgnLogoutTpl` &errTpl=`lgnErrTpl` &loginResourceId=`16` &logoutResourceId=`17`]]
    [[!Login? &loginTpl=`lgnLoginTpl` &logoutTpl=`lgnLogoutTpl` &errTpl=`lgnErrTpl` &loginResourceId=`20` &logoutResourceId=`17`]]
    [[!Login? &loginTpl=`lgnLoginTpl` &logoutTpl=`lgnLogoutTpl` &errTpl=`lgnErrTpl` &loginResourceId=`21` &logoutResourceId=`17`]]
    


    The logout page is the same for all groups as it's just generic.

    I tried using this snippet in the same TV / chunk, but it doesn't seem to work at all or do anything:

    [[!redirectUsergroups? &redirs=`Group1:16,Group2:20,Group3:21`]]
    


    Anyone got any ideas about this?
      • 10405
      • 288 Posts
      If I put the redirectUserGroups snippet in my resource template, I noticed that after Group2 and Group3 users get redirected, they can get to their welcome page but only if they click the Signin button i.e only if they go back to signin.html.

      So it's far from ideal as they get redirected to the error page first (because they don't have access to the Group 1 welcome page), and only after they go back to the signin page do they get sent on to their own welcome page.

      ???
        • 10405
        • 288 Posts
        Fixed... I had to create a resource containing the redirect snippet, use a single login box on the signin page and point all users to the redirect snippet- which then sends them on to their respective welcome pages.

        Would be nice if Login could do this through a parameter of some sort (maybe it can, though I don't know about it)