
Originally Posted by
Bryan9898
I'll try to explain better.
When a new user enters teamspeak, he enters a temporary group. (Guest).
I would like to automatically add this user to the registered group.
Without being necessary to have to do this manually, you know?
This should do the sort of thing you want.
PHP Code:
try {
foreach($ts3_VirtualServer->clientList() as $Info)
{
if($Info["client_type"]) continue;
$DBID = $Info['client_database_id'];
#Change me to your group ID, i.e. 123
$AddGroup = "123";
#Check if user already has group $AddGroup if does, continue checking other clients.
$ServerGroups = explode(",", $Info['client_servergroups']);
foreach ($ServerGroups as $user => $user_id) {
if (in_array($user_id, $AddGroup)) {
Continue();
}
}
#Try to add user to group, if not catch error and continue script.
try{
$ts3_VirtualServer->serverGroupClientAdd($AddGroup, $DBID);
} catch (TeamSpeak3_Exception $e) { }
}
}