We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14645
    • 1 Posts
    Hi all.

    I am creating a site where several companies are given their own login details (one per company). The idea is that the company will log on and then be taken to a page tailored for them. I’m using the Login addon, which works well, but I can’t work out how to take users to a specific page once they have successfully logged in, depending on who they have logged in as.

    Any ideas?

    Many thanks - Jon
      • 7391
      • 49 Posts
      I’m not too sure if there’s an add on out there that can simplify this task.. But i’m pretty sure that with a little bit of research you should be able to find some sort of conditional redirect script that you can tag with the Modx log-in extra.

      Something along the lines of:
      var this = "attach something on the page that can be tagged to the logged in user"
      if(this == "company1")
       // redirect
      else if (this == "company2")
       // redirect
      else
       // redirect
      



      Good luck bro
        • 3749
        • 24,544 Posts
        I haven’t tried it, but I think this would work.

        Create a user setting called LoginPage for each use and set it to the ID of the resource you want to send them to.

        Then put this in the Login snippet tag:

        &loginResourceId=`[[++LoginPage]]`
          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