We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45217
    • 1 Posts
    Hello,
    I have worked myself, but i have some problems
    Small Question: I have installed on "System", "Package Management" Login. How to login now called:
    1) Package
    2) Module
    3) Extra
    4) Plugin
    What is the correct name?

    My question is: if I have made ​​an Login via the login dialog (newly registered users group "Webdesigners") appears, a logout link, so I know that the system recognizes the logged in user.

    How can I now change the menu or identify with PHP snippets, placeholders etc, whether the user is logged in and what group he belongs to.

    The code:

    [[+ modx.user.id: memberof = `web designers`: then = `Hello` web designers: else = `Hello visitor`]]

    it works but is not enough.
    Thanks for help and sorry for my english.
    • The Personalize snippet is good for that http://bobsguides.com/personalize-tutorial.html
        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
        • 44327
        • 3 Posts
        Hi,

        Quote from: sottwell at Sep 25, 2013, 01:38 PM
        The Personalize snippet is good for that http://bobsguides.com/personalize-tutorial.html

        this is not the wanted answer. He need to understand, how ModX works. [ed. note: marebe last edited this post 10 years, 7 months ago.]
          • 3749
          • 24,544 Posts
          The Personalize snippet will show one chunk to logged-in users and another chunk to not-logged-in users, so it's just a matter of putting different content in the different chunks.

          If you need to personalize the output based on user groups, you can use the &allowedGroups property in the Personalize snippet tag.

          The contents of the chunk you show to a particular group can be an entire menu (or a different Wayfinder call) or it can be as small as 'Hello web designers'.


          For example:

          YesChunk:

          <p>Hello web designers</p>



          NoChunk:

          <p>Hello visitor</p>


          BTW, Login is a package (and also an extra) that includes several snippets. The Login Snippet is the one you use to let people log in.

          Welcome to MODX smiley


          Personalize tag:

          [[!Personalize?
             &allowedGroups=`web designers`
             &yesChunk=`YesChunk`
             &noChunk=`NoChunk`
          ]]
          [ed. note: BobRay last edited this post 10 years, 7 months ago.]
            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
          • Of course, this being MODx, there are other ways of doing much the same thing. For example, you can use the "user" output modifiers to get most of the information you might want to display, such as Full Name:
            [[!+modx.user.id:userinfo=`fullname`]]

            Use them to determine if the user is a member of a specified group (no programming needed)
            [[!+modx.user.id:memberof=`Administrator`:then=`Administrator`]]
            [[!+modx.user.id:memberof=`Guests`:then=`Guest`]]
            [[!+modx.user.id:memberof=`web designers`:then=`Web Designer`]]
            


            Or use a snippet to determine the user's group:
            $groups = $modx->user->getUserGroups();

            will return an array of the user groups the user is assigned to that you can work with.

              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
              • 44327
              • 3 Posts
              Quote from: sottwell at Sep 27, 2013, 06:01 AM
              Of course, this being MODx, there are other ways of doing much the same thing. For example, you can use the "user" output modifiers to get most of the information you might want to display, such as Full Name:
              [[!+modx.user.id:userinfo=`fullname`]]

              Use them to determine if the user is a member of a specified group (no programming needed)
              [[!+modx.user.id:memberof=`Administrator`:then=`Administrator`]]
              [[!+modx.user.id:memberof=`Guests`:then=`Guest`]]
              [[!+modx.user.id:memberof=`web designers`:then=`Web Designer`]]
              


              Or use a snippet to determine the user's group:
              $groups = $modx->user->getUserGroups();

              will return an array of the user groups the user is assigned to that you can work with.


              Thank you very much!
              The one thing is, to learn the modx api calls for PHP-Code. How does it look, if one want to (using wayfinder) show to a usergroup the menu entry/document "ABC" and the other usergroup the entry/document "XZY"? If there is no user logged in, none of this menu entries should be shown.

              BTW: meck111 is working together with me. And I have to learn too.
              • If you are using Wayfinder, it won't make a menu entry for resources the user does not have permission to view.
                  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