0

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!

4
  • Can you shows the example you used for user plugin? Commented Feb 23, 2021 at 7:54
  • I used this example and changed the fields to the requirements of my project. docs.joomla.org/Creating_a_profile_plugin/en Commented Feb 23, 2021 at 13:17
  • Do you intend to use both onContentPrepareForm and onContentPrepareData events in the plugin? If so, due to an inconsistency in com_users the plugin should belong to system group. Commented Feb 24, 2021 at 20:58
  • Yes, I use both, so if I understand you correctly, I should build a system plugin. Where in the plugin do I need to put a specific code or identifier, that the plugin will show up in tab in the usergroups? Commented Feb 25, 2021 at 7:53

1 Answer 1

0

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; } 
1
  • Thank you, this information is what I am looking for. I will update when I succeeded with the extension. Appreciated! Commented Feb 26, 2021 at 16:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.