We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30319
    • 406 Posts
    I found these in output filters, are these more reliable, can they be used to redirect??
    isloggedin Returns true if user is authenticated in this context. [[+modx.user.id:isloggedin]]
    isnotloggedin Returns true if user is not authenticated in this context. [[+modx.user.id:isnotloggedin]]
      • 30319
      • 406 Posts
      Is it possible the problem is that it's a different context than 'web'??
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Quote from: TomMLS at Jan 22, 2012, 02:08 PM
        Then it should be checked -- these are to be private pages.
        If you check them, the snippet you put on it will never execute cause the page will be sent to the unauthorized page by MODX when the user doesn't have access to it, based on your ACL set up.

        if ($modx->userLoggedIn()) {
        //do something

        How in php do I make the above IF statement an if NOT -- where does the bang go??
        Does modx have a redirect to page that is redirect to a specific page??

        Thank you...

        if (!$modx->userLoggedIn()) {
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Quote from: TomMLS at Jan 22, 2012, 02:11 PM
          I found these in output filters, are these more reliable, can they be used to redirect??
          isloggedin Returns true if user is authenticated in this context. [[+modx.user.id:isloggedin]]
          isnotloggedin Returns true if user is not authenticated in this context. [[+modx.user.id:isnotloggedin]]

          Those output filters probably wrap the function are you using right now.

          You cannot (easily) redirect from an output filter.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 18373 ☆ A M B ☆
            • 3,141 Posts
            Quote from: TomMLS at Jan 22, 2012, 02:14 PM
            Is it possible the problem is that it's a different context than 'web'??

            That's why you're getting the current context in the snippet you posted, and using that to check.
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 30319
              • 406 Posts
                • 18373 ☆ A M B ☆
                • 3,141 Posts
                Nah if those packages installed normally it just means the transport packages aren't in core/packages, most likely an issue with the Articles build script.

                I think the problem is that you have no access to the page or resource you're requesting, and that because of that you're being sent to the unauthorized or error page. See "Unauthorized Versus Error Page" on http://bobsguides.com/revolution-permissions.html

                  Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                  Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                  • 30319
                  • 406 Posts
                  verrrry confusing because page #63 is protected and if anon user is unauthorized to see #63 the redirect should send them to #38 the login page which anon user IS authorized to see because it's the context's start page!! and #38 has no restrictions on it -- I must apologize for not understanding this and it's the reason why I feel strongly that documentation must include EXAMPLES that people can follow, particularly wrt ACLs.
                  I tried his method from the book on avoiding the error page and it's not written for people new to the subject, it's for people like Bob Ray. smiley aka programmers. smiley
                    • 30319
                    • 406 Posts
                    For now I decided to be a wimp because time is running out and I will make the 404/error page be a login page!!

                    Someday maybe I will understand MODx ACLs, but maybe not till 2025 smiley smiley

                    Thank you, Tom
                      • 18373 ☆ A M B ☆
                      • 3,141 Posts
                      It's not that difficult, but I think you're in too much of a rush to let it sink in and understand what Bob writes in the book and what has been said on this topic.

                      I also think you didn't set an unauthorized page through the system or context settings.

                      If #63 is protected, and you gave the "anonymous" user group access to "load" your resource group, the user who is not logged in will be forwarded to the unauthorized_page which should not be protected and probably needs a login form.
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.