I have been working on a custom component but now hit on an issue where I need to set up groups for ACL reasons. However, I cannot seem to find a valid method - I've crashed things so far. The group setup happens in the installation script, or at least should. A previous answer suggested this:

JModelLegacy::addIncludePath( JPATH_ADMINISTRATOR . 
                '/components/com_users/models/', 'UsersModel' );
$groupModel = JModelLegacy::getInstance( 'Group', 'UsersModel' );

$groupData = array(
    'title' => "NHCommision",
    'parent_id' => 5,
    'id' => 9

$groupModel->save( $groupData );

However, it doesn't seem to be working in the final version of 2.5. Based on the "Legacy" add it might be ment for 3.0 - is there a 2.5 equivalent?


This code is actually for Joomla 3.x, and I skipped v2.5, so can't be sure that it will work, but if not, perhaps it will give you a starting point to find the v2.5 equivalent:

 $basePath = JPATH_ADMINISTRATOR.'/components/com_users';
require_once $basePath.'/models/group.php';
require_once $basePath.'/models/level.php';

$model = new UsersModelGroup(array('table_path' => $basePath.'/tables'));
$data = array('id'=>0, 'parent_id' => '2','title'=>'MyUserGroup');
  • No luck had so far, I'm still searching for some kind of answer on this.
    – Merlin
    Mar 9 '15 at 18:26

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.