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 ?