We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28008
    • 23 Posts
    It would be great if you could tell whether a specific template will be available for certain usergroups or not . This could be really usefull. Example:

    A certain group of users is responsible for adding newsarticles on the website, the newsUsersGrp. This is the only type of content they can add or modify. There are 2 templates specifically designed for newsarticles and 50 other templates that have nothing to do with news. The users of newsUsersGrp should not be able to select any of the other 50 templates, but only the 2 templates that are meant for newarticles.

    Maybe this already is possible and I’m just still a Modx novice. Please tell me how it’s done in that case.

    Regards,

    Karel
      For those about to rock... I salute you
      • 3707
      • 241 Posts
      Take a look at the ManagerManager plugin http://modxcms.com/ManagerManager-1565.html.

      If you look in the documentation, the mm_hideTemplates parameter will do what you want.
      mm_hideTemplates($tplIds, $roles, $templates)

      Hides specified templates from the Templates drop down list

      $tplIds: The IDs of the templates which should be hidden from the templates dropdown. Can accept multiple fields separated by commas [Required]
      $roles: comma separated list of role IDs this should be applied to. Leave empty (or omit) for all roles [Optional - default is all]
      $templates: comma separated list of template IDs this should be applied to. Leave empty (or omit) for all templates [Optional - default is all]

      mm_hideTemplates(’0’); // Hide template 0 (blank) from all users
      mm_hideTemplates(’0,4’, ’1’); // Hide templates 0 and 4 from users with role "1"
        • 28008
        • 23 Posts
        Thanks for the URL bob1000. Quite usefull indeed.

        Wouldn’t it be beautifull when this show / hide mechanism for templates would be part of the Modx core package. So when modifying a template you could just say which groups can use it and which not. Just like documents.
          For those about to rock... I salute you