Esempio n. 1
0
 private function onInviteJoin(GWF_Group $group, GWF_User $user)
 {
     if (false === ($invite = GWF_UsergroupsInvite::getInviteRow($user->getID(), $group->getID()))) {
         return $this->module->error('err_not_invited');
     }
     if ($invite->getVar('ugi_type') !== 'invite') {
         return $this->module->error('err_not_invited');
     }
     if (false === $invite->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->onQuickJoin($group, $user);
 }
Esempio n. 2
0
 public function onInvite(GWF_Group $group)
 {
     $form = $this->getFormInvite($group);
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors . $this->templateEdit($group);
     }
     if (false === ($user = GWF_User::getByName($_POST['username']))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER') . $this->templateEdit($group);
     }
     $back = '';
     if (false === GWF_UsergroupsInvite::getInviteRow($user->getID(), $group->getID())) {
         if (false === GWF_UsergroupsInvite::invite($user->getID(), $group->getID())) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateEdit($group);
         }
     }
     $back = $this->sendInvitePM($user, $group);
     return $back . $this->module->message('msg_invited', array($user->displayUsername())) . $this->templateEdit($group);
 }