Luis Aguilar
unread,Aug 24, 2016, 5:25:40 PM8/24/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! General Development
Confirmed as Adam Rifat and Mark Dexter said, you can insert x number of rows into the usergroups table and then call the rebuild() method from the class JTableUsergroup, we did it from outside the framework as an independent routine, here's the code, though we haven't tried inserting all the records and then do a single call to rebuild(), we suppose must be the same.
Cheers.
<?php
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('ABSOLUTE_PATH', dirname(__FILE__));
define('RELATIVE_PATH', 'modules');
define('JPATH_BASE', str_replace(RELATIVE_PATH, "", ABSOLUTE_PATH));
require_once ( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once ( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
//require_once ( JPATH_BASE . DS . 'modules' . DS . 'mod_formTitular'.DS.'helper.php');
//jimport( 'joomla.application.module.helper' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
function insert_group(){
$db = JFactory::getDbo();
$query = "INSERT INTO #__usergroups (parent_id, title) VALUES (0, 'Some group name example here.')";
$db->setQuery($query);
$db->query();
$errno=$db->getErrorNum();
if($errno==0){
$JTUserGroup = new JTableUsergroup($db);
echo $JTUserGroup->rebuild();
echo "SUCCESS INSERTING ROWS";
}
else{ echo "FAILED TO INSERT ROWS"; }
}
insert_group();
?>