These forums have been archived and are now read-only.
The new forums are live and can be found at https://forums.eveonline.com/
phpBB 3.x API Registration Mod v6+
Parallax SHIFT // @SuunAblehart
Recruiting Pilots // Low-sec Pirate Corp
/*** Sets character's Forum permissions*/function eveapi_setForumGroups($userId, $forumGroupsNew, $characterName = "---"){ global $db, $config, $user; if(!is_array($forumGroupsNew)) { $forumGroupsNew = array(); } // Grab all the forumgroups and put them into an array to be able to easily request values for EVE related stuffz $forumGroupInfo = array(); $sql = "SELECT group_id, group_type, group_name, group_eveapi_special, group_eveapi_ts3, group_eveapi_jabber, group_eveapi_openfire FROM " . GROUPS_TABLE; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $forumGroupInfo[$row['group_id']]['group_name'] = $row['group_name']; $forumGroupInfo[$row['group_id']]['group_type'] = $row['group_type']; $forumGroupInfo[$row['group_id']]['group_eveapi_special'] = $row['group_eveapi_special']; $forumGroupInfo[$row['group_id']]['group_eveapi_ts3'] = $row['group_eveapi_ts3']; $forumGroupInfo[$row['group_id']]['group_eveapi_jabber'] = $row['group_eveapi_jabber']; $forumGroupInfo[$row['group_id']]['group_eveapi_openfire'] = $row['group_eveapi_openfire']; // Check if the group name is actually a language identifier // If so, grab the correct language string from the language file instead // ( group prefix is G_ ) if(isset($user->lang["G_" . $row['group_name']])) { $forumGroupInfo[$row['group_id']]['group_name'] = $user->lang["G_" . $row['group_name']]; } // By default the REGISTERED group_id is 2, but that may not be the case 100% of the time. if($row['group_name'] == 'REGISTERED') { $registeredGroupID = (int) $row['group_id']; } } $db->sql_freeresult($result); $forumGroups = array(); $sql = "SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id = " . (int) $userId; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $forumGroups[] = $row['group_id']; } $db->sql_freeresult($result); // All active users are part of the REGISTERED group. $forumGroups[] = $registeredGroupID; // Set array for TeamSpeak groups if Forum Groups are set to immune. $returnGroups = array(); // Set jabber access to default (just in case) $returnGroups["jabber"] = false; $returnGroups["openfire"] = array(); $returnGroups["TS"] = array(); // Add existing Special phpBB groups to new groups to ensure they are not removed. foreach($forumGroups as $currentForumGroup) { if ($forumGroupInfo[$currentForumGroup]['group_type'] == GROUP_SPECIAL) { $forumGroupsNew = $forumGroupsNew + array($currentForumGroup => false); } } // All active users are part of the REGISTERED group, so it is always "New" $forumGroupsNew = $forumGroupsNew + array($registeredGroupID => false); // Loop groups to determine if we need to remove some permissions foreach($forumGroups as $currentForumGroup) { // User should not be in this group, or is the special group? Hhmmm... if(!isset($forumGroupsNew[$currentForumGroup]) && !$forumGroupInfo[$currentForumGroup]['group_eveapi_special']) { group_user_del($currentForumGroup, $userId); cronlog("Removing user from Forum group -> " . $forumGroupInfo[$currentForumGroup]['group_name'], $characterName); } else { // User is part of this group, add the TeamSpeak groupId to the list if the group >0 if($forumGroupInfo[$currentForumGroup]['group_eveapi_ts3']) { $returnGroups["TS"][] = $forumGroupInfo[$currentForumGroup]['group_eveapi_ts3']; } // Add ejabberd access aswell if($forumGroupInfo[$currentForumGroup]['group_eveapi_jabber']) { $returnGroups["jabber"] = true; } // Add OpenFire access aswell if($forumGroupInfo[$currentForumGroup]['group_eveapi_openfire'] != "") { $returnGroups["openfire"][] = $forumGroupInfo[$currentForumGroup]['group_eveapi_openfire']; } } } // Maybe we need to add groups foreach($forumGroupsNew as $currentForumGroup => $defaultGroup) { if(!in_array($currentForumGroup, $forumGroups)) { group_user_add($currentForumGroup, $userId, false, false, (($defaultGroup) ? true : false)); cronlog("Adding user to Forum group -> " . $forumGroupInfo[$currentForumGroup]['group_name'], $characterName); } else { cronlog("User already part of Forum group -> " . $forumGroupInfo[$currentForumGroup]['group_name'], $characterName); } // User should be part of this group, add the TeamSpeak groupId to the list if the group >0 if($forumGroupInfo[$currentForumGroup]['group_eveapi_ts3']) { $returnGroups["TS"][] = $forumGroupInfo[$currentForumGroup]['group_eveapi_ts3']; } // Add ejabberd access aswell if($forumGroupInfo[$currentForumGroup]['group_eveapi_jabber']) { $returnGroups["jabber"] = true; } // Add OpenFire access aswell if($forumGroupInfo[$currentForumGroup]['group_eveapi_openfire'] != "") { $returnGroups["openfire"][] = $forumGroupInfo[$currentForumGroup]['group_eveapi_openfire']; } } return $returnGroups;}