Search code examples
joomlapermissionssubmitcategoriesarticle

Joomla: How to set user group access permission for article post?


I got several user groups with special rights and categories.

Example: Classes: A, B, C. Teachers: A, B, C.

Now if "Teacher A" creates an article within his categorie (A) via frontpage he's able to select a permissionlevel for this article (Group A, B, C access).

Is it possible to hide this "access level selection" and give an automatic access level, in this case "access level a", when posting into categorie a?

Thanks for any usefull help! :)


Solution

  • I've done something similar in the past on a client project. I ended up creating a template override for the edit layout by copying components/com_content/views/form/tmpl/edit.php to templates/mytemplate/html/com_content/form/edit.php. Then, I moved the fields around and hid the regular access level selection container. Then, I performed some logic to get the logged in user to determine what access level they should be selecting, and set that in a hidden field right before the closing form tag, so that when it got submitted, the form would take that value. The field I used looked like this:

    <input type="hidden" name="jform[access]" value="YOUR_GROUP_ACCESS_ID" />
    

    So, as Dmitry said, it does take a little bit of work, but it's not too difficult.