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

    We use a context dispatch plugin to switch contexts based on hostname.
    It's similar to the plugin here:

    https://gist.github.com/739044

    So 'http://foo.example.com' gets mapped to the 'foo' context, and 'http://bar.example.com' gets mapped to the 'bar' context, and so on.

    What is the best practice for handling manager logins?

    When the user goes to 'http://foo.example.com/manager', should I switch the context to 'foo' or to 'mgr'?



      • 3749
      • 24,544 Posts
      When a user is in the Manager, they should always be in the 'mgr' context. The contexts you create are front-end contexts.
        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
        • 34073
        • 34 Posts

        Okay, good to know that that's the way it is designed.

        However, using 'mgr' context for manager pages does pose some problems.

        For instance, we are using the filemanager_* context settings so that each context gets its own private directory for static files.

        If we make a user an administrator of a context, and they log into the manager, they will lose these settings and see the whole file tree.

        A grey area is the modx file browser. It lives under: 'http://foo.example.com/connectors/browser/directory.php?action=getList', and gets put in the 'mgr' context by the connector entry script.

        So even if you launch the filebrowser from a frontend context, you end up in the 'mgr' context, and you lose all your context-specific filemanager_* settings, and you get to browse the whole.

        Maybe this is all just a specific problem with the filebrowser system. But I wonder if there are other context settings that you would want an administrator of a context to retain when they log into the manager?

          • 28215
          • 4,149 Posts
          Re: Loading the browser processors: you just need to pass the 'wctx' param with the context you are wanting to load them in.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 34073
            • 34 Posts
            Thanks.

            My problem appears to be with tinyMCE inside of newspublisher. Adding a link or image from tinyMCE doesn't respect the filemanager_* settings, and I don't think it is getting wctx set correctly.

            I've tried setting $_REQUEST['wctx'] from an OnHandleRequest hook, but I don't think this is working.

            (I'm using a modified version of newspublisher, but I think this feature is in the original)
              • 3749
              • 24,544 Posts
              I think the problem is using TinyMCE in the front end. I'm not sure where TinyMCE gets its path information when used up front.
                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
                • 34073
                • 34 Posts
                Yeah, exactly. I spent a couple of hours wandering the twisty mazes of javascript and php that glue TinyMCE into MODx but haven't made any progress yet. sad
                  • 3749
                  • 24,544 Posts
                  Welcome to the "I hate TinyMCE" club. wink

                  Periodically, I hear rumors of a native WYSIWYG editor for MODX, which presumably would be context-aware and use the paths in the context settings.

                  I know some people were working on integrating the Aloha editor, but haven't heard anything on it lately.

                    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