We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23363
    • 43 Posts
    I hope somebody can help me with this;

    I want to make a personal menu for websusers, but I can’t figure out how to retrieve the webuser startpage, so i can use that as the start id in wayfinder. The menu itself is a chuck, with the wayfinder call inside.

    Thanx,

    Jeroen
      • 3749
      • 24,544 Posts
      Quote from: pierun at Oct 01, 2007, 04:14 PM

      I hope somebody can help me with this;

      I want to make a personal menu for websusers, but I can’t figure out how to retrieve the webuser startpage, so i can use that as the start id in wayfinder. The menu itself is a chuck, with the wayfinder call inside.

      Thanx,

      Jeroen

      The document IDs are listed next to the document names in the document tree at the left of the manager screen.

      I do something similar on one web site by using the Personalize snippet and two different wayfinder chunks. Personalize determines if the user is logged in or not.

      Here’s the Wayfinder chunk:

       [!Personalize? &yesChunk=`LoggedInWayfinderChunk` &noChunk=`NotLoggedInWayfinderChunk` &ph=`user`!]
      

      The `user` placeholder lets me put "You are logged in as [user]" at the top of the logged in menu.

      Here’s the LoggedInWayfinderChunk:
      You are logged in as: [+user+]<hr>
      [[Wayfinder?&startId=`0`&level=2 &titleOfLinks=`description`]]
      


      Here’s the NotLoggedInWayfinderChunk:

      [[Wayfinder?&startId=`0`&level=1 &titleOfLinks=`description`]]
      


      In my case, the logged in user sees the same menu but with an extra level visible. I just made the docs hidden from non-logged-in users be subdocuments. You’d probably want to leave out &level and just change the &startid to be the document at the top of your menu for logged-in users.

      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
        • 7231
        • 4,205 Posts
        That is a nice guide to using Personalize. Thanks, this sheds some light on things for me.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don&#39;t know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 23363
          • 43 Posts
          Thanks for the quick answer, but it I think it’s not what I meant.
          I want to show the user menu on every page and I’m using the personalize too.
          But the problem is that there are multiple users, each with there own menu. That’s why I need the web user start page

          The [+user+] thing is very handy by the way!

          Best regards,

          Jeroen
            • 3749
            • 24,544 Posts
            Quote from: pierun at Oct 01, 2007, 05:01 PM

            But the problem is that there are multiple users, each with there own menu. That’s why I need the web user start page

            Maybe I just need more sleep, but I’m not sure what you mean by "web user start page" and why you want it.

            I’m also foggy on where this individualized menu for each user will come from.

            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
              • 23363
              • 43 Posts
              If you create a webuser, you can give this user a start page. After login the webuser will be redirected to this page.
              So this start page id should be available somewhere. I would like to use this start page id as a start id in wayfinder to build a personalized menu.
              Under the startpage of the webuser(s) there will be more documents that should appear in the personalized menu.
                • 7231
                • 4,205 Posts
                Once the user has been direct to their page you can simply use the [~id~] to get the id for the current page.

                There is a snippet that will give you access to the user placeholder:
                http://www.modxcms.com/UserPlaceholders-1596.html

                I don’t see the login page id listed but you might be able to include it in the logic.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don&#39;t know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 3749
                  • 24,544 Posts
                  It may be even easier than that. I haven’t tried it but on the Wiki, it looks like the default value of the Wayfinder &startid parameter is the current document. If that’s the case,

                  [[Wayfinder]]

                  placed on the users start page should do what you want.

                  If not, as dev_cw suggests, [[Wayfinder &startid=`[~id~]` ]] should work for you.

                  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
                    • 23363
                    • 43 Posts
                    I found it. I think the problem with the above examples is that it is bassed on the current page. I made the menu this way at first. But when the user navigates to the public area the current page is lost.

                    I made a snippet with the following code:

                    <?php
                    $currentWebUser = $modx->getWebUserInfo($modx->getLoginUserID());
                    $sql = "SELECT setting_value FROM ".$modx->getFullTableName("web_user_settings")."
                    WHERE webuser=".$currentWebUser[’internalKey’]."
                    AND setting_name=’login_home’";
                    $rs = mysql_query($sql);
                    if (!$rs) {
                    webAlert("An error occurred while attempting to save the user’s attributes.");
                    exit;
                    }else{
                    $WebUserStartID = mysql_fetch_array($rs);
                    $modx->setPlaceholder(’user.WebUserStartID’, $WebUserStartID[0]);
                    }
                    ?>

                    And it works, you can use the WebUserStartID if you call the snippet and the folowing place holder [+WebUserStartID+]
                    ModX rocks!

                    Thanx everybody for your help!
                    Jeroen
                      • 3749
                      • 24,544 Posts
                      Glad you got it sorted. I thought you wanted to restrict the webuser to their specific menu. I should have realized that they might head for the public pages and that the custom menu wouldn’t follow them.

                      Also, it’s trivial, but I think you want

                      webAlert("An error occurred while attempting to save retrieve the user’s attributes.");

                      for your error message.

                      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