We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17885
    • 10 Posts
    Dear All,

    Can anyone please help me, how to get page ID of a private page(members only page) without login first?

    Thank you,
    Made
      • 3749
      • 24,544 Posts
      What version of MODX?

      And what do you know about the page you want to get the ID of (pagetitle, resource group membership, ??) ?

      Also, if you can say why you want the ID, there might be another way to do what you want.
        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
        • 17885
        • 10 Posts
        Quote from: BobRay at Jul 28, 2011, 10:36 AM

        What version of MODX?

        And what do you know about the page you want to get the ID of (pagetitle, resource group membership, ??) ?

        Also, if you can say why you want the ID, there might be another way to do what you want.


        I’m using modx revolution MODX Revolution 2.1.1.

        I have a newsletter website for my company which is have new edition every month.
        On each edition of the newsletter have a member page which is only viewable by a registered member. I’m using login snippet for member to login and view the member page.
        I put the snippet code on the main template. The snippet is like this [[!Login?loginResourceId=`MemberPageID`]]. So I need to get the member page ID automatically from each edition.

        Help me please.

        Thanks,
        Made

          • 3749
          • 24,544 Posts
          How about putting the ID of the new page in a Template Variable called MemberPageID attached to that template? Then your snippet property would look like this:

          [[!Login?loginResourceId=`[[*MemberPageID]]`]]


          When a new issue comes out, you’d just edit the login page and enter the new ID in the TV.
            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
            • 17885
            • 10 Posts
            Quote from: BobRay at Jul 29, 2011, 09:44 AM

            How about putting the ID of the new page in a Template Variable called MemberPageID attached to that template? Then your snippet property would look like this:

            [[!Login?loginResourceId=`[[*MemberPageID]]`]]


            When a new issue comes out, you’d just edit the login page and enter the new ID in the TV.

            Hi BobRay, thank you for the answer, but what about the MemberPageID of previous newsletter? I want to make it still viewable also.

            Thanks,
            Made
              • 3749
              • 24,544 Posts
              I would put a link to an "archives" page on the page that shows the current newsletter (or in its template).

              Then, on the archives page, use getResources, Wayfinder, or a custom snippet to show links to all the newsletters.

              I think I’d probably put each year’s newsletters under a separate container and use Wayfinder to show the links. The resource tree would look like this:

              Newsletters
                   2011
                       January
                       February
                       ...
                    2012
                       January
                       February
                       ...
                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