Exemplo n.º 1
0
 public function onKick(GWF_Group $group, $array)
 {
     if (!is_array($array)) {
         return '';
     }
     //		foreach ($array as $username => $stub) { break; }
     $username = key($array);
     if (false === ($user = GWF_User::getByName($username))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if ($group->getFounderID() === $user->getID()) {
         return $this->module->error('err_kick_leader');
     }
     if (!$user->isInGroupName($group->getName())) {
         return $this->module->error('err_kick', $user->displayUsername());
     }
     if (false === GWF_UserGroup::removeFromGroup($user->getID(), $group->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_kicked', array($user->displayUsername()));
 }