Looking for the info to have a custom User plugin but instead it shows up in the User, it needs to show up in the (User) group (backend Joomla Administrator). There is a very good example how to develop your own custom User plugin. It adds a tab to the existing User. Used that many times. Now I need to develop a similar plugin, but it needs to add a tab in the User group, because a setting has to apply for the whole group. Where in the plug should I make an adjustment so it will install as a plugin for the group. I assume in the .XML file but what line do I have to add or change. Appreciated!
1 Answer
As mentioned in the comments, there is an inconsistency in com_users which requires to create the plugin in system group for both onContentPrepareForm and onContentPrepareData events to work.
Change group attribute value in the manifest file to system:
<extension type="plugin" group="system"> Change plugin class name to follow Plg<Group><Name> convention, e.g. PlgSystemExample.
In plugin code change context checks to compare against com_users.group, e.g. in onContentPrepareData event:
// Check we are manipulating a valid form. Return early if not. if ($context !== 'com_users.group') { return true; } - Thank you, this information is what I am looking for. I will update when I succeeded with the extension. Appreciated!PWRM– PWRM2021-02-26 16:17:43 +00:00Commented Feb 26, 2021 at 16:17
onContentPrepareFormandonContentPrepareDataevents in the plugin? If so, due to an inconsistency incom_usersthe plugin should belong tosystemgroup.