We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    In my resource I’m calling Login and specifying a page to redirect to on successful login:

    [[!Login? &loginResourceId=`24`]]


    But the argument isn’t being detected by the code in the snippet:

    if (!empty($response) && is_array($response)) {
                                     $modx->log(modX::LOG_LEVEL_ERROR,"login - resource not empty & is array");
    
                    if (!empty($response['success']) && isset($response['object'])) {
                        if (!empty($loginResourceId) && ($url = $modx->makeUrl($loginResourceId, $loginContext, '', 'full'))) {
                                     $modx->log(modX::LOG_LEVEL_ERROR,"loginResourceId found: $loginResourceId");  //<!-- expecting to see this
                            $modx->sendRedirect($url);
                        } elseif (isset($response['object']['url'])) {
                                     $modx->log(modX::LOG_LEVEL_ERROR,"elseif...response-object-url"); //<!-- this is what's coming through in the logs
    
                            $modx->sendRedirect($response['object']['url']);
                        } 


    Am I doing something wrong?

      • 22303 MODX Staff
      • 10,725 Posts
      I’ve been traveling all day, but will investigate and get back to you. It’s most likely a bug, but I will try to confirm for you tomorrow.
        • 28215
        • 4,149 Posts
        You could file it as a bug here:

        http://github.com/splittingred/Login/issues
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 16859
          • 8 Posts
          I"m not getting a response either. Using revolution. I used the loginResourceId just like mentioned above and the login doesn’t get redirected to the resource I set it to. Anyone have a clue whats going on yet?
            • 3749
            • 24,544 Posts
            Is the user logged in successfully?

            Does the user have the correct permissions to access the resource you’re sending them to?

            Can the user access that page directly by URL after logging in?


              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
              • 16859
              • 8 Posts
              Ok I noticed something. if I use the command as
              [[!Login? &loginResourceId=`2`]]
              it doesn’t work....BUT if I do
              [[!Login?loginResourceId=`2`]]
              it works? Its the properties syntax from the Revo. documentation. I even extended it just fine as
              [[!Login?loginResourceId=`2` &logoutResourceId=`1`]]
              (at the moment I was using 2 resources with 1 template.) It was great help to me. does it fix anyone else’s problem?

              *corrected
                • 28215
                • 4,149 Posts
                You need to be using ` instead of ’.
                  shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                  • 16859
                  • 8 Posts
                  Yes! thanks! I corrected the code. In the working code I was using ` and not ’ so much for typing off the top of my head. tongue

                  [[!Login? &loginResourceId=`2`]]
                  Did Not work
                  [[!Login?loginResourceId=`2`]]
                  works for me & Its the properties syntax from the Revo. documentation.
                  [[!Login?loginResourceId=`2` &logoutResourceId=`1`]]
                  What I did with 2 resources using 1 template. also worked.
                    • 73
                    • 37 Posts
                    Does anyone know if this is an official bug?
                    Getting very frustrated just trying to redirect web users to page 2 after login.

                    [[!If?  
                        &subject=`[[+modx.user.id]]`  
                        &operator=`GT`   
                        &operand=`1`  
                        &then=``   
                        &else=`[[!Login?loginResourceId=`2`&redirectToPrior=`0`]]<p class="lgnlink"><a href="[[~46]]">Forgotten Password?</a></p>`]]
                    


                    Tried many variations of [[!Login?loginResourceId=`2`&redirectToPrior=`0`]] but no joy!
                    And modResource 2 is definitely available to the resource group..

                    Thanks for any tips in advance.
                      • 17499 ☆ A M B ☆
                      • 872 Posts
                      Try

                      [[+modx.user.id:gt=`1`
                      	:then=`[[!Login?loginResourceId=`2`&redirectToPrior=`0`]]<p class="lgnlink"><a href="[[~46]]">Forgotten Password?</a></p>`
                      	:else=``
                      ]]