We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10812
    • 1 Posts
    Firstly my apologies if these questions should be in separate topics.

    I am running modx revo 2.1.1 and I would like numpty-proof the manager: customize the manager so that there is absolutely nothing in the manager that the user doesn’t need to see.

    1. How can I redirect all users to edit a resource on login, instead of showing the manager home page?

    2. Is it possible to make it so that when a certain user group clicks on a container it either presents them with a link saying ’Click here to create a new page under this container’ or it simply creates a new resource and takes them to the edit page.

    3. How can I remove the whole of the modx header and menu (navbar and topbar) just for certain user groups?

    Many thanks in advance!
      • 3749
      • 24,544 Posts
      1. You should be able to create a plugin tied to OnManagerAuthentication with something like this:

         If ($user->get('username') != 'admin') {
             $modx->sendRedirect('url/to/other/manager/page');
         }


      You can get the URL by going to the Create/Edit resource page and cutting and pasting the URL from the browser’s address bar.

      2. I don’t know of an easy way to do this.

      3. You can go to System -> Actions and add one or more custom permissions to each menu choice, then give some users those custom permissions. Important: Be sure to give yourself the custom permissions *before* adding them to the actions.

      You might consider just having them work in the front end with NewsPublisher, FrontPage, or one of the other front-end editing extras.
        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
        • 10812
        • 1 Posts
        Bob,

        Thank you very much for this advice, I successfully created the plugin to help with 1.

        I also (using this and your Modx object guide - http://bobsguides.com/revolution-objects.html) managed to write a plugin to solve the second thing I wanted to do, I’m not sure if it’s the right way to go about it, but it works! Here’s the code in case anyone else was wondering how I did it:-

        1. Create a plugin that fires on the event ’onDocFormRender’

        2. Put this code in it:-

        $id = $_GET['id'];
        $resource = $modx->getObject('modResource',$id);
        $container = $resource->get('isfolder');
        
        if ($container == 'modx' && $_GET['a'] != 47) {
           $modx->sendRedirect("manager/?id=3&a=47&class_key=modDocument&parent=$id&context_key=web");
        }
        
        return;


        It should probably get the context_key of the parent document, but since the website I’m doing in this case only has the web context it works fine.
          • 36225
          • 20 Posts
          3. You can go to System -> Actions and add one or more custom permissions to each menu choice, then give some users those custom permissions.

          This works for the present menus, but I don’t see one for the Home menu?
          I’ve tried to remove the "home" permission, but the menu is still there, clicking on it gets you an Error, access denied then.
          Any clue?

          Thanks!
            • 3749
            • 24,544 Posts
            Since the ’Home’ item doesn’t show up in the right-hand tree in Manager->Actions, I don’t think there’s any way to do it. It would be a good bug/feature request.
              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