function &fetch_rank(&$userinfo) { global $vbulletin; if (!is_array($vbulletin->ranks)) { // grab ranks since we didn't include 'ranks' in $specialtemplates $vbulletin->ranks =& build_ranks(); } $doneusergroup = array(); $userrank = ''; foreach ($vbulletin->ranks as $rank) { $displaygroupid = empty($userinfo['displaygroupid']) ? $userinfo['usergroupid'] : $userinfo['displaygroupid']; if ($userinfo['posts'] >= $rank['m'] and (!isset($doneusergroup["{$rank['u']}"]) or $doneusergroup["{$rank['u']}"] === $rank['m']) and ($rank['u'] > 0 and is_member_of($userinfo, $rank['u'], false) and (empty($rank['d']) or $rank['u'] == $displaygroupid) or $rank['u'] == 0 and (empty($rank['d']) or empty($userrank)))) { if (!empty($userrank) and $rank['s']) { $userrank .= '<br />'; } $doneusergroup["{$rank['u']}"] = $rank['m']; for ($x = $rank['l']; $x--; $x > 0) { if (empty($rank['t'])) { $userrank .= "<img src=\"{$rank['i']}\" alt=\"\" border=\"\" />"; } else { $userrank .= $rank['i']; } } } } return $userrank; }
function viewranks_init() { global $mybb, $db, $cache, $templates, $header, $footer, $headerinclude, $title, $theme, $parser; if ($mybb->settings['rpgsuite_groupranks'] && $mybb->input['action'] == "showranks") { // Get group id if ($mybb->input['gid'] != '') { $gid = intval($mybb->input['gid']); } else { $gid = $mybb->user['displaygroup']; } $usergroup = new UserGroup($mybb, $db, $cache); if ($usergroup->initialize($gid)) { $group = $usergroup->get_info(); // Add Group Styling eval("\$headerinclude .= \"" . $templates->get('rpgmisc_groupstyle') . "\";"); if ($group['hasranks']) { $title = $group['title'] . " Ranks"; if ($group['fid']) { add_breadcrumb($group['title'] . ' Forum', 'forumdisplay.php?fid=' . (int) $group['fid']); } add_breadcrumb($group['title'] . ' Ranks'); $tierlist = build_ranks($usergroup); $unrankedlist = build_unranked($usergroup); eval("\$rankpage = \"" . $templates->get('rpggroupview_ranks_full') . "\";"); output_page($rankpage); } else { $title = $group['title'] . " Members"; if ($group['fid']) { add_breadcrumb($group['title'] . ' Forum', 'forumdisplay.php?fid=' . (int) $group['fid']); } add_breadcrumb($group['title'] . ' Members'); // set up the pager $multipage = setup_viewgroup_pages($group['gid'], $usergroup->get_member_count(), $start); $memberlist = build_members($usergroup, $start); eval("\$memberpage = \"" . $templates->get('rpggroupview_noranks_full') . "\";"); output_page($memberpage); } exit; } } }
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("UPDATE " . TABLE_PREFIX . "user SET displaygroupid = 0 WHERE displaygroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("UPDATE " . TABLE_PREFIX . "useractivation SET usergroupid = 2 WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("UPDATE " . TABLE_PREFIX . "subscription SET nusergroupid = -1 WHERE nusergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2 WHERE pusergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("UPDATE " . TABLE_PREFIX . "userban SET usergroupid = 2 WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("UPDATE " . TABLE_PREFIX . "userban SET displaygroupid = 0 WHERE displaygroupid = " . $vbulletin->GPC['usergroupid']); // now get on with deleting stuff... $db->query_write("DELETE FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("DELETE FROM " . TABLE_PREFIX . "forumpermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("DELETE FROM " . TABLE_PREFIX . "ranks WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("DELETE FROM " . TABLE_PREFIX . "usergrouprequest WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("DELETE FROM " . TABLE_PREFIX . "userpromotion WHERE usergroupid = " . $vbulletin->GPC['usergroupid'] . " OR joinusergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("DELETE FROM " . TABLE_PREFIX . "imagecategorypermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); $db->query_write("DELETE FROM " . TABLE_PREFIX . "attachmentpermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']); build_ranks(); build_forum_permissions(); require_once DIR . '/includes/adminfunctions_attachment.php'; build_attachment_permissions(); // remove this group from users who have this group as a membergroup $updateusers = array(); $casesql = ''; $users = $db->query_read("\n\t\tSELECT userid, username, membergroupids\n\t\tFROM " . TABLE_PREFIX . "user\n\t\tWHERE FIND_IN_SET('" . $vbulletin->GPC['usergroupid'] . "', membergroupids)\n\t"); if ($db->num_rows($users)) { while ($user = $db->fetch_array($users)) { $membergroups = fetch_membergroupids_array($user, false); foreach ($membergroups as $key => $val) { if ($val == $vbulletin->GPC['usergroupid']) { unset($membergroups["{$key}"]); } }