1

I am writing a component which creates two user groups by install. I'd like the component to keep the same groups by update (maybe change the group title) and remove these groups by uninstall. Should I store the group ids in a custom table like #__example_configuration: [option, value], or is there a built in api, maybe helper in Joomla which does the same? I'll probably need to access this info by updates, and I guess using a json file would not work, because I guess it would be automatically replaced by the json file of the new component release.

Solution:

It is still a question where to put non editable config options, for example if I want to save a group id and I don't want to ask every time the system, what is the group id of registered or admin users. That's just an example. I accepted the solution, because nobody else answered. I used a separate table for the config options, it was faster than learning how to write xml for config edit forms and how to backup config. I recommend to use the built in api and add config.xml files https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_configuration/en and probably add a query cache file instead of a separate table if you have such non editable options I mentioned.

0

Maybe I misunderstood your question, but you seem that you just need to do that in a config.xml file. Check the administrator/components/com_content/content.xml and how it includes the config.xml file, and then check the administrator/components/com_content/config.xml file.

  • I think you misunderstood. I guess config.xml is about the configuration you can set on admin site. This is something different. The component adds the groups by install and removes these groups by uninstall automatically. I just want to save the group id, so it will know which group is which. The ids are set by the database by insertion to the usergroups table, so the values are not predictable, and the system should set them. So this is not about configuration on the admin site. – inf3rno Feb 16 '17 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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