0

I have multiple user groups that can only edit and create their own articles and categories. This works fine for existing articles and categories but when someone in that group creates a new article/category and sets the access to the group 'public', everyone can access it, from every group.

Is it possible that for example if a user belong to group: 'User group A' and he creates a new article or category, that at the access dropdown there is only the option 'User group A'?

3
  • What have you tried so far? Template override? Any research? Made any progress? Please show us anything that you have accomplished so that volunteers don't feel like they are doing free development for you. Commented Sep 25, 2020 at 8:24
  • @mickmackusa I've tried looking for this in my joomla admin, created multiple user groups and made sure only that user group can edit and create articles/categories. Not much more because I don't know where to look. I don't want anyone to do free development for me, just maybe someone knows where I can find this in the joomla settings. I'm not looking to code anything, I'm just wondering if there is a setting that can achieve what I need.
    – twan
    Commented Sep 25, 2020 at 8:43
  • because it appears that this question has been abandoned/unresolved, the system has bumped it to the top of the questions list to spur new activity/attention. Please return to this question and cooperate with Robbie to progress this page to a system-recognised resolution (preferably a green ticked answer). Commented Oct 31, 2020 at 0:47

1 Answer 1

0

I guess the first thing to say is to highlight the fact that user groups and access levels are not the same thing. You can choose to configure your Joomla instance to give access levels and user groups the same names, but adopting this solution to your question will place constraints on how your user data must be configured. A user may also be assigned to more than one usergroup, so again I'm assuming that you're constraining your data to use only one usergroup for users who will edit articles.

As regards the solution, you'll need to write code to implement what you want. I haven't coded this up, but I'm fairly confident it will work.

Firstly you have to write a custom form field for the Access field which you want to implement. Make your class extend JFormFieldList, and in your getOptions() method get the current user's usergroup name, and find the access level value which matches that usergroup name.

The Joomla User API Guide provides direction in using the User APIs, but I think you might need to do a direct query on the viewlevels table to get the name of the access levels on your system, to match against the user's usergroup.

Then you can implement a content plugin which listens for onContentPrepareForm. Your plugin will be called when com_content has built the form for editing an article, but before it has rendered it. You need to manipulate the form to swap out the standard Access field and replace it with your own custom field. Help and examples relating to dynamically changing forms can be found at Joomla Advanced Form Guide.

Best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.