Line 435 in
my admincp/usergroup.php has this:
PHP Code:
// insert
/*insert query*/
$db->query_write(fetch_query_sql($vbulletin->GPC['usergroup'], 'usergroup'));
$newugid = $db->insert_id();
You can find out what fetch_query_sql() does in the vBulletin API Docs, the best thing would be to run a var_dump() on
$vbulletin->GPC['usergroup'] to see what it contains, you can then duplicate this how you see fit.
Good luck, doesn't seem like an easy task!
http://members.vbulletin.com/api/ - vBulletin 3.6 Code Documentation