We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    This is an auto-generated support/comment thread for MemberCheck.

    Use this forum to post any comments about this addition or any questions you have regarding its use.

    Brief Description:
    Checks a logged in user’s group memberships and displays a chunk. Can be used multiple times on a page.
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 18503
      • 45 Posts
      I’m having trouble getting MemberCheck to work.

      Here’s my call:
      [[MemberCheck?&groups=`Users`&chunk=`paypalbutton`]]

      and here’s the error i get on the page i called it to:

      Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ’}’ in (site root removed for this post)/manager/includes/document.parser.class.inc.php(705) : eval()’d code on line 65

      {{paypalbutton}} works fine on its own... and "Users" is a correct group. Any ideas?

      i’m using Modx version 0.9.2.1

      Thanks in advance!
        -dan
        http://wylio.com
        Wylio - Pictures for Bloggers
        • 10487 MODX Staff
        • 1,535 Posts
        Grab yourself the PHP4 version of MemberCheck, it’s available on the same repository page as the main Membercheck - just scroll down to the ’Extras’ section.

        (Future releases of MODx will include the PHP4-compatible version in the core distribution)
          Garry Nutting
          Senior Developer
          MODX, LLC

          Email: [email protected]
          Twitter: @garryn
          Web: modx.com
          • 18503
          • 45 Posts
          Great, thanks! Works like a charm.
            -dan
            http://wylio.com
            Wylio - Pictures for Bloggers
            • 11523
            • 5 Posts
            Im calling the snippet like this

            [[MemberCheck? &groups=`Blog Readers,Registered Users` &chunk=`privateSiteNav` &ph=`MemberMenu` &debug=`true`]]

            I have the group Registered Users but it insits that it doenst exists.

              • 18503
              • 45 Posts
              Is your registered users a web users group? Also, is your group name Registered Users or is it RegisteredUsers or Registered users? (or some other close variation). You’ve probably already checked these things, but just in case not i thought i’d throw in my two cents.
                -dan
                http://wylio.com
                Wylio - Pictures for Bloggers
                • 5338
                • 35 Posts
                How is used &ph parameter?

                I’m using this calling: "[!MemberCheck? &groups=`Registered Users` &chunk=`privateSiteNav` &ph=`MemberMenu` &debug=`true`!]"

                and I use a chunk called "privateSiteNav"

                Placing a "[+MemberMenu+]" placeholder inside the "privateSiteNav" chunk doesn’t happen anything. It only shows the plain chunk.
                  • 12652
                  • 228 Posts
                  I finally got this to work... I was confusing the placeholder with the username placeholder from the Personalize snippet.

                  Would I’d ideally like to have is a combination of Personalize and MemberCheck... the ability to show a yes or no chunk based user group, not just that they are a logged in member. Or is there something that already does this that I missed?
                    | Identity Developments delivers SEO focused web design and web presence services
                    - it's not about websites, it's about your identity. |
                    • 32319
                    • 129 Posts
                    I just added a peram called &default to MemberCheck to allow for a default chunk to be inserted when there is no group match. I have done a fair amount of testing and it all seems solid so let me know if any issues come up.

                    OpenGeek: If you like this addition and feel it is inside the scope of MemberCheck feel free to merge it in. It tried to true your code but I am fairly new to programming so hopefully it is up to par wink.

                    Most of my changes are lines 124 through 139, 151, 153 and 71 with updated comments and docs.

                    Enjoy!
                      "Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
                      -- Sydney Harris
                      • 32319
                      • 129 Posts
                      I am also thinking about adding &loggedin (optional) and &loggedout (optional) perams that would optionally show a chunk based on a members log-in/out status.

                      I envision the logic going something like this:
                      1) If a user is logged in and a member of one of the assigned &groups they would get the &chunk chunk.
                      2) If a user is logged in and is NOT member of one of the assigned &groups they would get the &loggedin chunk.
                      3) If no users are logged in but &loggedout was defined they would get the &loggedout chunk.
                      4) If no other chunk peram is called (&chunk, &loggedin, &loggedout) but &default is assigned they would get the &default chunk as a catch all (something will always be displayed).

                      I think these 4 perams could give fairly powerful control over what was displayed for the user based on a combination of rules.

                      I would like everyones thoughts and feedback on this before I get started though. Also seems that there could be better names for the &loggedin and &loggedout perams but nothing is coming to mind right now (just &in and &out may work?).

                        "Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
                        -- Sydney Harris