1

Following my previous post, trying to make the load of config component lighter. Since, the majority of my usergroups are children of the registered usergroup and inherit the same permissions, I don't need them to get loaded in com_config.

As a workaround, I am looking for a way to filter them out, by hacking the core code. I tried with a where in the getUserGroups() function in : /administrator/components/com_config/models/fields/filters.php, as well in

`/administrator/components/com_config/model/fields/filters.php` .

The function became like:

protected function getUserGroups()
    {
        // Get a database object.
        $db = JFactory::getDBO();
        // Get the user groups from the database.
        $query = $db->getQuery(true);
        $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level');
        $query->from('#__usergroups AS a');
        $query->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt');
        $query->where('a.parent_id != 2');
        $query->group('a.id, a.title, a.lft');
        $query->order('a.lft ASC');
        $db->setQuery($query);
        $options = $db->loadObjectList();
        return $options;
    }

But these changes seem to have no effect in the groups loading of the com_config. I did the same change in /libraries/joomla/form/fields/rules.php, and this filters out those groups. But I am afraid that this might act globally in what u.groups Joomla will see, affecting some of the components that I need to see those u.groups.

At first, why the hack on the com_config getUsergroups() function has no effect ? What should I do in order to achieve my filtering there ? Secondly, I am right to consider that my second modification will hide those u.groups from everywhere in Joomla ?

0

I ended up by hacking the rules.php inside:

/libraries/joomla/form/fields/rules.php

As it is documented inside the file, this is a form class for assigning permissions to groups for a given asset.

The getUserGroups() in the com_config seems to do nothing for permissions groups load, but it is used for the groups in the filters section (obviously).

Checking in com_users, I can still see my extra usergroups and probably I will still have the required access for my other needs.

So in my case, this small core hack will keep me going, till Joomla comes out with a better solution. Of course it is not maintainable an I should manually re-do this after any updates.

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.