Ejemplo n.º 1
0
 public function onQuickJoin(GWF_Group $group, GWF_User $user)
 {
     if ($user->getID() === '0' || $group->getID() === '0') {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === GWF_UserGroup::addToGroup($user->getID(), $group->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_joined', array($group->getName()));
 }
Ejemplo n.º 2
0
 private function createBoard(GWF_Group $group)
 {
     $name = $group->getName();
     $pid = $this->module->getForumBoard()->getID();
     //		$pid = Common::clamp($this->module->cfgBID(), 1);
     if (false === GWF_ForumBoard::getByID($pid)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $groupid = $group->getID();
     $options = GWF_ForumBoard::ALLOW_THREADS;
     if (false === ($board = GWF_ForumBoard::createBoard('Usergroup: ' . $name, 'Board for the ' . $name . ' group', $pid, $options, $groupid))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $group->saveVar('group_bid', $board->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false !== ($error = $this->module->adjustFlags($group))) {
         return $error;
     }
     return false;
 }
Ejemplo n.º 3
0
 private function getPMMessage(GWF_User $user, GWF_Group $group, $bbcode = true)
 {
     # bbcode urls, no web root needed
     $href_join = '/index.php?mo=Usergroups&me=Join&gid=' . $group->getVar('group_id');
     $href_deny = '/index.php?mo=Usergroups&me=Join&deny=' . $group->getVar('group_id');
     $founder = $group->getFounder();
     if ($bbcode === true) {
         $link_yes = sprintf('[url=%s]%s[/url]', $href_join, $href_join);
         $link_no = sprintf('[url=%s]%s[/url]', $href_deny, $href_deny);
     } else {
         $link_yes = GWF_HTML::anchor($href_join, $href_join);
         $link_no = GWF_HTML::anchor($href_deny, $href_deny);
     }
     return $this->module->langUser($user, 'invite_message', array($user->getVar('user_name'), $founder->getVar('user_name'), $group->getName(), $link_yes, $link_no));
 }