We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51258
    • 4 Posts
    Hello. Please help, i'm newbie in this CMS, i know how to use snippets\chunks, but i don't know how to get id of resource which redirects me to unaouthorized page.
    I have several groups for user\resources. So...
    I need this for detecting groupid of resource, to show user some specific info.

    Thank u
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Create your unauthorized page resource. It should be published, but not show in menus. Then once you're happy with how it looks, go to your System Settings and in the Site section scroll down to the Unauthorized page and put the ID of the resource you created. The ID is the number in parentheses to the right of the resource's name in the Resource Tree.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 51258
        • 4 Posts
        Quote from: sottwell at Oct 15, 2015, 04:55 AM
        Create your unauthorized page resource. It should be published, but not show in menus. Then once you're happy with how it looks, go to your System Settings and in the Site section scroll down to the Unauthorized page and put the ID of the resource you created. The ID is the number in parentheses to the right of the resource's name in the Resource Tree.

        Thank u and sorry for my english, but it's already done.

        ModX allows to create several user groups, so, some resources are readble only by some users group, some by another users group. but if you are guest you'll recieve default and everytime the same result: "Unaouthorized page".
        So If i'm guest with no-access to this resources, somehow, I need to know which group of resource was requested OR i need to get resourseid (not resource id of authorized page) of requested page.

        My apologies for poor explanation
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ah, now I understand. What you want is in PHP's $_SERVER['HTTP_REFERER']. You'll need a snippet to get the resource object with that URL's alias, then get its ID.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 51258
            • 4 Posts
            Thanks, and one more question, please explain how to get resourceid via $_SERVER['HTTP_REFERER'] string?
              • 51258
              • 4 Posts
              Quote from: i-trap at Oct 16, 2015, 12:37 AM
              Thanks, and one more question, please explain how to get resourceid via $_SERVER['HTTP_REFERER'] string?
              Oh i found this, i'll try

              $resourceId = $modx->findResource($uri, $contextKey);