We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Interesting, I would have thought it would be the other way around. I've read that there are some problems with makeUrl() in 2.2.7, so that might be part of it.

    For new resources, if this code isn't there already, it might help to add it above the makeUrl() call, but after the save:

    $modx->reloadContext('web');


    Part of the problem is that makeUrl() is ultimately a method of the Context object and I'm not sure there's a way to know which context it is at the point where the user is forwarded.

    One trick that sometimes helps is to set a $_SESSION variable with the Resource ID and forward the user to an intermediate page with a known URL. On that page, a snippet checks the $_SESSION variable and forwards the user to the target page.

    BTW, make sure the user is logged in to all Contexts they might be sent to (using something like &contexts=`web,de,context3`) in the Login snippet tag).
    [ed. note: BobRay last edited this post 11 years, 6 months ago.]
      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
      • 43509
      • 24 Posts
      Well, actually it does not seem to achieve any effect.
        • 3749
        • 24,544 Posts
        Are you using 2.2.7?

        If so, the next update may (or may not) fix things for you.
          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
          • 43509
          • 24 Posts
          No, I am using 2.2.6.
            • 3749
            • 24,544 Posts
            OK, I'm stumped. I'll have to run some tests when I have time (not any time soon, I'm afraid).

              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
              • 42168
              • 2 Posts
              Quote from: BobRay at May 18, 2013, 12:49 AM
              Some other things to try:

              Comment out lines 1529 and 1530:

              // $controller = $this->modx->getOption('request_controller',null,'index.php');
              // $goToUrl = $controller . '?id=' . $postId;


              If that doesn't do it, try changing line 1524 to this:

              $goToUrl = $this->modx->makeUrl($postId, $this->resource->get('context_key'), "", "full");


              Let me know if anything works.

              I had the same problem that after editing a resource and clicking submit, it would save the resource perfectly but redirect to www.mywebsite.com/en/index.php?id=23.
              Using your above suggestions fixed this issue for me. I'm on modx 2.2.9
                • 3749
                • 24,544 Posts
                Which suggestion was that, adding reloadContext()?
                  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