We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/270">ManagerCheck </a> by sottwell.

    Brief Description:
    Display chunk for specified manager users.
      • 4971
      • 964 Posts
      I am using ManagerCheck to display stuff in the front for managers only.

      I am getting the following error and I do not have a clue of what it means
      or how to troubleshoot it... I have debug turn on but it does not seem to do anything.

      The error is:

      « MODx Parse Error »
      MODx encountered the following error while attempting to parse the requested resource:
      « PHP Parse Error »
       
      PHP error debug
        Error: 	Invalid argument supplied for foreach()	 
        Error type/ Nr.: 	Warning - 2	 
        File: 	/home2/mercolog/public_html/teampitt/manager/includes/document.parser.class.inc.php(770) : eval()'d code	 
        Line: 	114	 
       
      Parser timing
        MySQL: 	0.0259 s	(191 Requests)
        PHP: 	0.1091 s	 
        Total: 	0.1350 s
      


      my call is as follows:

      [[MemberCheck? &groups=`mugSiteAdmin, mugSiteAssistant` &chunk=`crmChunk`]]
      


      Also, how do I include the administrator (the all powerful) in the list?
      Thanks
        Website: www.mercologia.com
        MODX Revo Tutorials:  www.modxperience.com

        MODX Professional Partner
        • 3749
        • 24,544 Posts
        I’m not sure about the error, it may mean that the parser is getting sent an empty document list.

        On the Super Admin, you can just add that user to one of your mug groups.
          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
          • 4971
          • 964 Posts
          Thanks for the help Bob,
          unfortunately I cannot make it work
          so maybe I will try using PHx...

          maybe if Susan is lurking around here...
            Website: www.mercologia.com
            MODX Revo Tutorials:  www.modxperience.com

            MODX Professional Partner
            • 3749
            • 24,544 Posts
            The most common cause of that error is that the first argument in the foreach call is not an array.

            You might try just making sure that you have more than one manager document group and more than one user group.

            Otherwise, I see that ManagerCheck has only one foreach. Try changing this:

             foreach ($dgn as $k => $v) {


            to this:

            foreach ( (array) $dgn as $k => $v) {
              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
              • 4971
              • 964 Posts
              THanks Bob, I also checked for the only foreach in ManagerCheck
              and it is passing an array to $dgn and still it gave me the error.

              So instead I used the PHx extender for checking if the user is
              logged into the manager (less control but it is what I need) and
              it works easily and flawlessly...

                Website: www.mercologia.com
                MODX Revo Tutorials:  www.modxperience.com

                MODX Professional Partner
                • 3749
                • 24,544 Posts
                Glad you got it working (though I wonder why the (array) cast didn’t prevent the error).
                  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
                  • 31178
                  • 128 Posts
                  I think I found a bug in this ManagerCheck snippet.

                  For the isMemberOfGroup function around line 122

                                  $tbl= $modx->getFullTableName("documentgroup_names");


                  ... to pick up the manager user groups and not the resource groups it should be:

                                  $tbl= $modx->getFullTableName("membergroup_names");


                  You might get away with it if your manager group and resource group were the same name, but mine are not.