We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29525
    • 388 Posts
    I have created a client login page on my site. After login they land on a container document which contains children documents with user specific web permissions. (e.g. there are four documents in the container, guest1 can see docs 1 & 2 and guest2 can see docs 3 & 4. I have two document groups one for each guest. The container doc is associated to both doc groups.

    Additionally, when they are logged in, an additional menu item appears on the horizontal menu at the top of the page. So far so good.

    When the guest navigates to other pages in the site, the "My Pages" menu item disappears. I would like that to remain while their logged in so they can navigate back to their pages.

    I have a sidebar on the home page that has a permanent link back to My Pages so then can return to their pages--but I’d prefer to have it in the main menu bar.

    Can someone offer any suggestions for this?

    Here’s my site. You can login as guest1 or guest2 with same name for the password.

    http://www.terrybarthdesign.com
      www.terrybarthdesign.com
      • 29525
      • 388 Posts
      Hey GameshXL

      Thanks for the quick response. I think, maybe, I understand what this snippet and API would do. I assume the code passes the document ID for the logged-in username to Wayfinder to include in the menu? Is that right?

      Unfortunately, I haven’t a clue how to implement this. I’m new to MODx (about 4 months) and I’m not a programmer so I don’t really understand how to use the code you referenced.

      I can live with what I have, if there are no other options.

      Thank you again for your help.

      Terry
        www.terrybarthdesign.com
        • 4310
        • 2,310 Posts
        This is untested in this specific circumstance but I use it for various other tasks.
        Create a snippet named "Eval" with this code in it:
        <?php 
        if ($modx->getLoginUserID()) return ''; 
        else return '89' ;
        ?>

        Then in your Wayfinder call add :
        &excludeDocs=`[[Eval]]`

        If your Wayfinder call is cached then the Eval call must be uncached or vice versa.
        Should work! but untested with Wayfinder
        EDITED
          • 29525
          • 388 Posts
          Bunk58

          I received this error:

          « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[[Eva)) AND sc.id IN (1,71,61,77,2,5,74,7,8,11,15,33,39,32,4,37,46,83,6,87,89) G' at line 1 »


            www.terrybarthdesign.com
            • 29525
            • 388 Posts
            GaneshXL

            So this outputs a chunk if the user is logged in. Good. I understand I could then insert chunk that has a link back to My Pages. How would add the page to the wayfinder menu?

            Currently, in my sidebar, I have a link back to the My Pages that only appears when someone is logged in. Wouldn’t the member check do basically the same thing?

            Terry
              www.terrybarthdesign.com
              • 3749
              • 24,544 Posts
              Just another thought here. If you look at the Personalize snippet, it shows one chunk to logged in users and another to not-logged-in users. As is, it won’t do what you want, but you could modify it to show a chunk named after the user (or user group). If you don’t need too many menus, you could just create a chunk containing the appropriate Wayfinder call for each menu you want to show and let your modified Personalize snipppet select the right one to display.

              As always, in MODx there are a number of different ways to do whatever you want. wink

              Bob
                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
                • 29525
                • 388 Posts
                BobRay

                Thank you! I think this would be the same effect as using the membercheck and the same effect I already by displaying a link to the personal pages.

                Still don’t know how I’d make that one page appear in the wayfinder menu based on the login.

                Fortunately I do have a link to the personal pages appearing when needed--just not in the menu.

                I appreciate everyone’s input! Thank you so much.

                Terry
                  www.terrybarthdesign.com
                  • 3749
                  • 24,544 Posts
                  Glad you got it working.

                  If you want to put it in a Wayfinder menu, put each group’s documents in a separate container and use that container as the Wayfinder &startId. You can then put the Wayfinder call with that startID in the appropriately-named chunk and display it for the correct people.

                  Hope this makes sense.

                  Bob
                    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