We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20044
    • 33 Posts
    I have a webuser signup document which is public. By default this document can be viewed by registered webusers as well. Is there is creative way using document groups and permissions to hide this page (menu item) completely from already registered users, or should I use a snippet on this page to tell them they’re already registered?
      • 7455
      • 2,204 Posts
      paste this in a snippet and place on the home page, logged in users will be redirected to the homepage.
      redirectsnippet:
      $Url= $modx->makeUrl($modx->config['site_start']);
      if ($modx->getLoginUserID()){ $modx->sendRedirect($Url);}
      



      or use this to return style="display:none;" that you could place in any tag:
      hidesnippet:
      if ($modx->getLoginUserID()){return 'style="display:none;"';}else{return;}


      then use this in your code like this:
       <a href="[~10~]" title="login here" [[hidesnippet]]>login</a>
      or on from elements: <form [[hidesnippet]]>...formdata bla bla... </form>
      
      then when a user is logged in the form is hidden or the link is hidden.
      
      Greets Dimmy
      
        follow me on twitter: @dimmy01
        • 20044
        • 33 Posts
        Thank you Dimitri! So simple yet so modx smiley
          • 3749
          • 24,544 Posts
          Quote from: modxxx at Aug 29, 2007, 06:38 AM

          I have a webuser signup document which is public. By default this document can be viewed by registered webusers as well. Is there is creative way using document groups and permissions to hide this page (menu item) completely from already registered users, or should I use a snippet on this page to tell them they’re already registered?

          I may be misunderstanding it, but I don’t think Dimmy’s solution will actually hide the menu item.

          I show a different menu to logged on users by using the Personalize snippet which will insert two different chunks depending on whether a user is logged in or not:

               <div id="wayfinderMenu">
                   [!Personalize? &yesChunk=`LoggedInWayfinderChunk` &noChunk=`NotLoggedInWayfinderChunk` &ph=`user`!]
             </div>
          


          Rather than customize the menu or use permissions, I just put the pages that I wanted to hide at a different level in the document tree.

          My scheme does the opposite of what you want (it shows MORE menu items to logged in users), but it might give you some ideas. Here is my "LoggedInWayfinderChunk":

          <b>  Logged in as: [+user+]</b><hr>
          [[Wayfinder?&startId=`0`&level=2 &titleOfLinks=`description`]]
          


          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