It seems that nobody else had this (as a) problem. Just in case, here is the solution as I see it now:
In simple words: the change of usertype requests the
update of
two tables:
__users and
__core_acl_groups_aro_map
and uses the
__core_acl_aro table as a lookup.
[code:1]
$acl =& JFactory::getACL($uid);
$new_usertype = 'Author';
$new_group_id = $acl->get_group_id('',$new_usertype,'ARO');
// Update __users:
$sql = "UPDATE #__users SET usertype= '$new_usertype', gid=" . (int) $new_group_id ." WHERE id=" . (int) $uid ." AND gid < $new_group_id";
$_CB_database->SetQuery($sql);
$_CB_database->query();
// look up aro_id from __core_acl_aro:
$sql = "SELECT id FROM #__core_acl_aro users WHERE value=" . (int) $uid;
$_CB_database->SetQuery($sql);
$aro_id = $_CB_database->loadResult();
// use aro_id to update __core_acl_groups_aro_map:
$sql = "UPDATE #__core_acl_groups_aro_map SET group_id = $new_group_id WHERE aro_id =$aro_id";
$_CB_database->SetQuery($sql);
$_CB_database->query();
[/code:1]
I reckon that one can get this done in involving the Joomla Framework more extensively but I felt more comfortable to do it this way.
Maybe a Joomla Expert is willing to post here his/her script doing it all on 3 lines of code ...