We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5253
    • 17 Posts
    Hi everyone!

    I just installed the ManagerCheck Extra by sottwell and I got a big problem sad
    If the management group (e.g. siteadminXYZ) doesn’t exist I got the following error by using this snippet call:
    [!ManagerCheck? &groups=`siteadminXYZ` &chunk=`send_newsletter` &debug=`true`!]

    Error: The group siteadminXYZ could not be found.

    Ok that’s what the debugging do. Everything is ok so far. But if the group exists I got a parse error.

    PHP error debug
    Error: Invalid argument supplied for foreach()
    Error type/ Nr.: Warning - 2
    File: path_to_modx\manager\includes\document.parser.class.inc.php(769) : eval()’d code
    Line: 131

    I just want to include a chunk/snippet on an front end webpage, if an management user is logged in...

    EDIT:
    I just tested to original MemberCheck Snippet by logging in as a webuser -> works fine. Only the ManagerCheck won’t work...

    Hopefully someone has an idea to solve this problem.

    Thanks in advance!
    Chris
      *there are no strangers - just friends who never met*
      • 27310
      • 18 Posts
      Hi,

      I’ve fixed an mistake ...
      ==DESCRIPTION==
      If you have this module at two points at your site (f.e. in the header and in the footer of your page ...) and in the header you set debug=TRUE
      In the footer this variable is ALSO AUTOMATICALY =TRUE !!!

      ==HOW TO FIX==
      Replace the function "getInstance" with this code:
      		function getInstance($debug) {
      			static $instance;
      			if (!isset ($instance)) {
      				$instance = new MemberCheck($debug);
      			}
      			else {
      				// THIS IS IMPORTANT !!!
      				/*
      					If you use this module twice on your page and at the first point you seht debug=TRUE - at the secound point debug is also TRUE
      				*/
      				$instance->MemberCheck($debug);
      			}
      			return $instance;
      		}
      

      -> Yes - I know that this isn’t a clean solution ... But it works ...

      I’ve also addet a function for all who do not only want to check the UserGroup but want to check the DocumentGroup.

      Here in my attachment (zip) are two text-files:
      * The first file is the complete Snippet - v1.2
      * The second file is a patch-File which contains all changes between the v1.1 and my new version ...
        • 27310
        • 18 Posts
        Quote from: chrizz at Jan 11, 2009, 01:03 PM

        Hi everyone!

        I just installed the ManagerCheck Extra by sottwell and I got a big problem sad
        If the management group (e.g. siteadminXYZ) doesn’t exist I got the following error by using this snippet call:
        [!ManagerCheck? &groups=`siteadminXYZ` &chunk=`send_newsletter` &debug=`true`!]

        Error: The group siteadminXYZ could not be found.

        Ok that’s what the debugging do. Everything is ok so far. But if the group exists I got a parse error.

        PHP error debug
        Error: Invalid argument supplied for foreach()
        Error type/ Nr.: Warning - 2
        File: path_to_modx\manager\includes\document.parser.class.inc.php(769) : eval()’d code
        Line: 131

        I just want to include a chunk/snippet on an front end webpage, if an management user is logged in...

        EDIT:
        I just tested to original MemberCheck Snippet by logging in as a webuser -> works fine. Only the ManagerCheck won’t work...

        Hopefully someone has an idea to solve this problem.

        Thanks in advance!
        Chris

        I’m sorry for this doublePost ...

        I’ve looked at the functions of the ManagerCheck...
        Hey: I had to look in the GoogleCache because this site has an ModX-ParseError: http://modxcms.com/ManagerCheck-1787.html grin grin

        And it seems that this doesn’t check for ManagerUser but instead of that it do the same as my script - MemberCheck v1.2 laugh
        For more questions pleace ask me ...
          • 28173
          • 409 Posts
          There is a problem to download this snippet : http://modxcms.com/extras.html?view=package/view&package=270
          For some reason, the file repo-1787.txt was not found. The website administrators have been notified of this issue and will resolve it shortly.
          If a moderator can solve the problem... some will appreciate wink
            • 25663 MODX Staff
            • 12,272 Posts
            Please report all problems with the download system via the Feedback button on the website. Thanks!
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 28173
              • 409 Posts
              It’s done now smiley
                • 27261
                • 10 Posts
                Yikes!

                [[!MemberCheck? &groups='Administrator,Oracle,Member' &chunk='privateSideMenu' &default='publicSideMenu' &debug='true']]


                yields...

                Fatal error: Using $this when not in object context in /home/hanneman/public_html/core/model/modx/modscript.class.php(96) : eval()'d code on line 59


                Apache 2.0.63 (Unix), PHP-5.2.5, ModX Revolution 2.0.0-beta-1

                All chunks exist and work fine by themselves, all the user group exist and turning off the [[!...]] no-cache option has no effect. Any ideas?

                Thanks,
                - Peter
                  • 28215
                  • 4,149 Posts
                  Quote from: hannemanp at Jul 02, 2009, 01:51 PM

                  Apache 2.0.63 (Unix), PHP-5.2.5, ModX Revolution 2.0.0-beta-1

                  All chunks exist and work fine by themselves, all the user group exist and turning off the [[!...]] no-cache option has no effect. Any ideas?

                  Known and fixed bug. Just uploaded a fixed version. Click ’Update Package’ in Package Management to update the package and fix the bug.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 27261
                    • 10 Posts
                    Works beautifully - thanks for the update. smiley

                    Edit:
                    Seems I spoke too soon. The updated version no longer throws the error but with the debug mode enabled I’m getting:

                    The group 'Member' could not be found...

                    With the following query:
                    [[!MemberCheck? &groups='Member' &chunk='privateSideMenu' &default='publicSideMenu' &debug='true']]


                    Looking from the manager under Security > Manage User Groups and Roles, "Member" is one of three groups listed there. None seem to be detected by the snippet. I’ve cleared the site’s cache and flushed permissions, still no luck.

                    Edit2:
                    Apparently ’ ’ does not equate to ` `. So much time on something so silly.

                    Thanks for all the help and quick turn around to the earlier problem!
                    - Peter
                      • 32393
                      • 29 Posts
                      I see that this will display chunks which of course can only be html, no php. So, what if I want to use MemberCheck but I want to use php or use a snippet? For example, I’ve tried including a snippet inside of a chunk, but it doesn’t work.

                      Basically if no one is logged in I want the login and registration forms to show. So, I was going to add [!WebLogin!] and [!WebSignup!] in a chunk named NotLoggedin. Well, when I do this, the login and registration forms don’t show, just the "[!WebLogin!]" and "[!WebSignup!]" text shows.

                      Does this snippet not allow other snippets inside the chunks? Or, maybe a better question is: Can you put snippets inside of chunks?