We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3707
    • 241 Posts
    And does it work...
      • 12684
      • 118 Posts
      No. Only the first link appears and works.

      <li>[+phx:mo=`Vendors`:then=`<a href="[~40~]">My Account</a>


      The nextGroupCheck does not work.
        • 3749
        • 24,544 Posts
        The MemberCheck snippet will show one chunk to selected users and another to everyone else. It can be used multiple times on a page so if the logic works out for you, you can show it once with a link for guests and twice more with an empty link for non group members.

        If that doesn’t work, I think the easiest thing would be to just take some of the code from the MemberCheck snippet and roll your own snippet with a switch statement to output as many different kinds of links as you need.
          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
          • 12684
          • 118 Posts
          I am trying MemberCheck now, and I am running into the same problem. I can only do 1 User group and a default. However like I have stated I have more that one. It is working with using what is below, except it will show the default link twice. Even if I only put default in one call.

          [!MemberCheck? &groups=`Vendors` &chunk=`loginmenuVendor` &debug=`true`!]
          [!MemberCheck? &groups=`Registered Members` &chunk=`loginmenuMembers`  &default=`loginmenuStock` 
          &debug=`true`!]
            • 3749
            • 24,544 Posts
            Here’s another thought. You could duplicate the MemberCheck snippet and, in the duplicate copy, just comment out the code that puts out the alternate chunk. Then, use that duplicate snippet for your second and third snippet calls.
              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
              • 12684
              • 118 Posts
              The problem Bob is that no matter what, you have an issue with two links showing at once.

              I did find a snippet that was made a while back called extMemberCheck

              http://modxcms.com/forums/index.php/topic,11865.0.html

              This one will certainly work, however it needs to be updated to have the &default variable. To set the default chunk.

              Some one should be able to take the membercheck 1.1 and integrate the &default variable into the extMemberCheck. I tried but I get errors.

              Could some one try it for me? please.
                • 3707
                • 241 Posts
                I just tested the PHx version using the exact same code and with the same web groups set up that you have and it worked perfectly for me!

                If I’m not logged in I get the Login link, if I make my test user a member of the Vendors web group and login as that user I get the link to ID 40 and get the link to ID 5 if the user is a member of the Registered Members web group.

                Just to make sure, you do have the PHX plugin installed, yes? And you are testing the code by logging in as different users?

                Are you calling your original chunk {{Loginmenu}} directly from a page or template or are you calling it from inside a snippet?
                  • 3749
                  • 24,544 Posts
                  Quote from: IG88 at Jul 12, 2008, 07:17 AM

                  The problem Bob is that no matter what, you have an issue with two links showing at once.

                  If the viewer is only qualifies for one of the links and all the alternate links are empty chunks, only one link should show.
                    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
                    • 12684
                    • 118 Posts
                    You guys are right, but here is the part your missing.

                    Group1 logged in shows link1 -when not logged in it shows nothing.

                    Group2 logged in show link2 -when not logged in it shows nothing.

                    The third call shows the default link. We will call this Link3. What tells this call to not show the link?? It can not be dependent on 2 separate other calls.

                    **The problem exist when Group1 or Group 2 is logged in -It will show their link, Sure, but it is also going to show default link3 of the third call. Because the separate calls for group1 and group2 do not effect each other, or link3.

                    That is if you use the phx or the membercheck. How else can you do it? Both of these snippets are only allowing one or another. Not one or another or another.

                    The problem is when either group is logged IN. Nothing removes link3.

                    @bob1000 Yes to all of your questions.

                    FYI: I am also using WLPE

                    Can anyone do the below. I do not see any other option.

                    I did find a snippet that was made a while back called extMemberCheck
                    
                    http://modxcms.com/forums/index.php/topic,11865.0.html
                    
                    This one will certainly work, however it needs to be updated to have the &default variable. To set the default chunk.
                    
                    Some one should be able to take the membercheck 1.1 and integrate the &default variable into the extMemberCheck. I tried but I get errors.
                    
                    Could some one try it for me? please.



                    @bob1000

                    Please show me exactly what you used so I can diagnose it here.
                      • 3707
                      • 241 Posts
                      OK, first I created two chunks, {{Loginmenu}} and {{nextGroupCheck}}.

                      {{Loginmenu}}
                      <h2>Main</h2>
                      <ul>
                      <li><a href="http://www.site.com/">Home</a></li>
                      <li>[+phx:mo=`Vendors`:then=`<a href="[~40~]">My Account</a>`:else=`{{nextGroupCheck}}`+]</li>
                      <li><a href="[~43~]">Brides</a></li>
                      <li><a href="[~1~]">Calendar</a></li>
                      <li><a href="[~30~]">FAQ</a></li>
                      </ul>


                      {{nextGroupCheck}}
                      [+phx:mo=`Registered Members`:then=`<a href="[~5~]">My Account</a>`:else=`<a href="[~2~]">Login</a>`+]


                      I then placed {{Loginmenu}} in my template where I want the menu to appear.

                      The logic works like this. When the {{Loginmenu}} chunk is called, the first PHx test is run:

                      Is the user a member of group Vendors?
                      Yes - display <a href="[~40~]">My Account</a>
                      No - display {{nextGroupCheck}} chunk

                      If the test returns No, the {{nextGroupCheck}} chunk is called and the second PHx test is run:

                      Is the user a member of group Registered Members?
                      Yes - display <a href="[~5~]">My Account</a>
                      No - display <a href="[~2~]">Login</a>

                      In which case, only one link will be displayed. Does this make sense?