When users who are not authorized to see a page try to access it, the code on the page never executes. They get sent immediately to the error page or the unauthorized page depending on how you have things set up. The page isn't even parsed if they're not authorized to see it.
One option is to make the Login page into either the error page or the unauthorized page by changing the error_page and/or unauthorized_page System Settings.
Another method is described here:
http://bobsguides.com/blog.html/2013/05/22/protecting-pages-the-easy-way/
-
☆ A M B ☆
- 24,524 Posts
Basically, if a user group does not have permission to load the resource, then it won't ever get to the point of redirecting to the "unauthorized" page, it will just automatically be sent to the "not-found" page for resources belonging to that group. So the Anonymous group has to be given load permission for the resource group.
http://rtfm.modx.com/revolution/2.x/administering-your-site/security/security-tutorials/more-on-the-anonymous-user-group
discuss.answer
The unauthorized page and the error page should not be put in any Resource Group. Try removing them from any Resource Groups and clearing the site cache.
If that doesn't help, try pasting your snippet code here (in code tags).
The unauthorized page and the error page was not in a Resource Group. But it was fixed thanks to your advice about "clearing the site cache". I cleared it, and magicly it worked. Thank you for your time and your attention.