} else {
        updateUser($arrValuesToUpdate);
    }
    if (isset($_POST['group']) && !empty($_POST['group'][0])) {
        $arrGroupIDsNew = readPostVar('group');
        unset($arrGroupIDsNew[0]);
        $arrGroupIDsToAdd = array();
        $arrGroupIDsToDelete = array();
        //9917//9917
        $i_rSet1 = $g_db->Execute("SELECT " . $srv_settings['table_prefix'] . "groups_users.groupid FROM " . $srv_settings['table_prefix'] . "groups_users WHERE id=" . $f_id);
        if (!$i_rSet1) {
            showDBError(__FILE__, 1);
        } else {
            while (!$i_rSet1->EOF) {
                if (!empty($arrGroupIDsNew[$i_rSet1->fields['groupid']])) {
                    unset($arrGroupIDsNew[$i_rSet1->fields['groupid']]);
                } else {
                    array_push($arrGroupIDsToDelete, $i_rSet1->fields['groupid']);
                }
                $i_rSet1->MoveNext();
            }
            $i_rSet1->Close();
        }
        foreach ($arrGroupIDsNew as $key => $val) {
            array_push($arrGroupIDsToAdd, $key);
        }
        manageUserGroups(array($f_id), $arrGroupIDsToAdd, true);
        manageUserGroups(array($f_id), $arrGroupIDsToDelete, false);
    }
    gotoLocation('users.php');
}
function api_manageUserGroups($i_ids = array(), $arrGroupIDs = array(), $i_addtogroup = true)
{
    return manageUserGroups($i_ids, $arrGroupIDs, $i_addtogroup);
}