We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    Is it possible to assign manager user groups to a language so that I can manage what languages people can manage? The idea is to assign manager users to a group and then bind that group to 1 or more languages. That way people can only change their own language and not mess with the others.

    I think it is the easiest to manage this through ManagerManager, but how can I arrange this?
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 22851
      • 805 Posts
      Quote from: MediaGuy at Dec 13, 2009, 02:02 PM

      Is it possible to assign manager user groups to a language so that I can manage what languages people can manage? The idea is to assign manager users to a group and then bind that group to 1 or more languages. That way people can only change their own language and not mess with the others.

      I think it is the easiest to manage this through ManagerManager, but how can I arrange this?
      Nice idea. I can see how that would be useful. I agree that it would be easiest to implement this using ManagerManager. Please can you try out the attached patch to the yams.mm_rules.inc.php file which should add such functionality?

      To use this you need to define an array called $yamsLanguageRoleMap which maps language ids to a comma separated list of roles (ManagerManager format) that can access the language. For example
      $yamsLanguageRoleMap = array( 'en' => '1' );

      would mean that only administrators (role 1) would have access to English.
      $yamsLanguageRoleMap = array( 'en' => '!1' );

      would mean that all roles apart from administrators (role 1) would have access to English.

      If a language is left out of the array, all roles have access to the language. If the $yamsLanguageRoleMap array is not defined at all YAMS falls back to the default of allowing all roles access to all languages.

      You need to define this array before the
      require( $modx->config['base_path'] . 'assets/modules/yams/yams.mm_rules.inc.php' );

      line in your ManagerManager rules chunk.

      Let me know how you get on.

      EDIT: If this works fine, then for the next release I will probably add the $yamsLanguageRoleMap array to the YAMS config file and allow it to be managed via the YAMS module interface.
        YAMS: Yet Another Multilingual Solution for MODx
        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • 25483
        • 741 Posts
        Great, I will test this as soon as possible!!!
          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media

          • 25483
          • 741 Posts
          Just got some time to test it, it seems to work great!

          Is it also possible to create a function to show a languages content, but to deny editing of it? I need to show the english language as reference, but users shouldn’t be allowed to edit that tab. Is it possible to create a tab (with ManagerManager) and show custom content in it? That way we could make a view which only displays the content without editor.

          //edit

          after some more testing I discovered some error:

          $yamsLanguageRoleMap = array( 'nl' => '1,4', 'fr' => '1' );



          I used this setting with 3 languages active (nl, en, fr), I see every tab in the manager with the administrator role, but the tab with the NL language doesn’t show any content. When I check it with a "role 4" user I see content at the NL language tab.

          I think their is a problem with setting multiple roles, when I set this I have the same problem but then with role 4:
          $yamsLanguageRoleMap = array( 'nl' => '4,1', 'fr' => '1' );
            with regards,

            Ronald Lokers
            'Front-end developer' @ h2o Media

            • 25483
            • 741 Posts
            Does someone know how to fix this? My php skills are too low to fix this sad
              with regards,

              Ronald Lokers
              'Front-end developer' @ h2o Media

              • 22851
              • 805 Posts
              Apologies. I misread the ManagerManager documentation and so didn’t implement the negation of the roles list correctly. I have updated the YAMS ManagerManager rules. Please can you see if this fixes the problem you encountered?
                YAMS: Yet Another Multilingual Solution for MODx
                YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                • 25483
                • 741 Posts
                Thanks for the update, I will try it later this week!
                  with regards,

                  Ronald Lokers
                  'Front-end developer' @ h2o Media

                  • 25483
                  • 741 Posts
                  Did some tests and it does work now.
                    with regards,

                    Ronald Lokers
                    'Front-end developer' @ h2o Media