We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36467
    • 73 Posts
    www.amitpatil.me Reply #1, 7 years ago
    What i am trying to do : Well, i am trying to achieve multiple context login (in my case its multiple subdomains). I managed to do it using below 3 steps (this is for other users who are struggling to make it work like me)
    1) Changed "session_cookie_domain" setting from blank to ".mydomain.com"
    2) Added context names to login snippet
    [[!Login? &context=`web,data,tech`]]

    3) "Clear cache" from inside modx manager. And you are done.

    After these 3 steps it worked on plain demo page but when i added login snippet code to my live home page it didnt worked, after troubleshooting i found that
    <base href="https://www.mydomain.com/">
    is causing the problem, i removed <base> tag to fix the problem. (Note: Font awesome throws CORS error if we use <base> tag, so i had to add some .htaccess rules to make them work together).

    Problem : Login snippet works on all other pages except home page. Strange thing is that, i created duplicate of home page "www.mydomain.com/home-copy" and login works on this page, but doesnt work on "www.mydomain.com". Both pages have same template, use same login form chunk and snippet call.

    Anyone faced same issue ? Any clue will be much appreciated as well.

    This is my snippet call code

    [[!Login? &loginTpl=`mlogintop_2017` &fbloginurl=`[[!sociallogin]]` &contexts=`web,main,tech,data`]]

    [ed. note: amitpatil last edited this post 7 years ago.]
      • 36467
      • 73 Posts
      www.amitpatil.me Reply #2, 7 years ago
      Any clues ? Wild guesses ?
      • Do you have FriendlyURLs enabled?
          • 3749
          • 24,544 Posts
          Did you try this as the base href call in the template (with the exclamation point):

          <base href="[[!++site_url]]" />


          Without the exclamation point, the site_url value may come from the cache and can be wrong on multiple-context sites.
            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