We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16171
    • 3 Posts
    Bug is described here :

    http://bugs.modx.com/issues/3034

    The problem comes when you call $resource->save(); (\core\model\modx\processors\resource\create.php line 273).
    When a function call is not stored context. I solved this problem by removing the default value for context from the file \core\model\modx\mysql\modresource.map.inc.php line 49.

    I want to know if I should do?

    PS. I hope my comments will help in solving this problem.
    PPS. Sorry for my English, I used Google translator
      • 3749
      • 24,544 Posts
      Instead of modifying the code, I think you need to give yourself permission to create and save resources in the other context.

      Go to Security -> Access Controls -> User Groups tab

      Right-click on the Administrator group and select "Update User Group"
      Click on the "Context Access" tab.
      Click on the "Add Context" button.

      Context: Select the other context
      Minimum Role: admin Super User
      Policy: Administrator

      Click on the save button.

      Security -> Flush Permissions
      Security -> Flush Sessions


        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
        • 16171
        • 3 Posts
        Rights have been configured correctly (I configured them the same context, the Web)

        After several hours of debugging using x-debug I found out the reason, but I do not know whether corrected.

        if you look at x-debug $resource->context_key=="myCtx" and after $resource->save() (in the parent class modResource) $this->context_key=="web",
          • 3749
          • 24,544 Posts
          I’m not finding that in the code. Can you tell me what file it’s in?
            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
            • 16171
            • 3 Posts
            1) Put a breakpoint on this line

            (breackpoint there) if ($resource->save() == false) {
            return $modx->error->failure($modx->lexicon(’resource_err_save’));
            }

            (\core\model\modx\processors\resource\create.php line 273)

            2) watch $resource->context_key (I see "myCtx")
            3) step into
            4) throws us into a class modResource (\core\model\modx\modresource.class.php line 382)

            public function save($cacheFlag= null) {
            if ($this->_new) {
            if (!$this->get(’createdon’)) $this->set(’createdon’, time());
            if (!$this->get(’createdby’) && $this->xpdo instanceof modX) $this->set(’createdby’, $this->xpdo->getLoginUserID());
            }
            $rt= parent :: save($cacheFlag);
            return $rt;
            }
            5) watch $this->context_key (and what I see?? I see "web")




              • 22303 MODX Staff
              • 10,725 Posts
              It is indeed a critical bug for multi-context usage and will be addressed ASAP.
                • 19534
                • 183 Posts
                I ran into this bug, too. Is there allready a bug report to be able to track this issue?
                  Add-On to easily manage your multilingual sites: Babel
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: Jakob at Dec 15, 2010, 10:38 AM

                  I ran into this bug, too. Is there allready a bug report to be able to track this issue?
                  http://bugs.modx.com/issues/3034