these two functions work in conjunction with eachother
PHP Code:
function grps_getgroupinfo($groupid)
{
global $vbulletin;
$groupid = intval($groupid);
$grps_groupinfo = $vbulletin->db->query_first("
SELECT grps.groupid, grps.title, grps.description, grps.approved, grps.create_date, grps.leaderid, grps.membercount, user.username AS leadername, grps_categories.catid, grps_categories.title AS catname, grps_setting.image_name, grps_setting.private_posts, grps_setting.moderate_members, grps_setting.hidden_group, grps_setting.hide_image, grps_setting.edit_details, grps_setting.leaderonly_threads, grps_grouptext.pagetext AS spew, grps_grouptext.edit_reason, grps_grouptext.edit_dateline, grps_grouptext.edit_username
FROM grps_setting
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = grps.leaderid)
LEFT JOIN grps ON (grps.groupid = grps_setting.groupid)
LEFT JOIN grps_grouptext ON (grps_grouptext.groupid = grps.groupid)
LEFT JOIN grps_categories ON (grps_categories.catid = grps.catid)
WHERE grps.groupid = $groupid
GROUP BY grps.groupid
ORDER BY grps.groupid DESC
");
return $grps_groupinfo;
}
function grps_getgroupsettings($raw_groupinfo)
{
global $vbulletin, $stylevar;
require_once('./includes/class_bbcode.php');
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$grps_rin = rand(1,$vbulletin->options['grpsnumrandimages']); //random image if they've failed to upload an image
$raw_groupinfo['catname'] = stripslashes($raw_groupinfo['catname']);
$raw_groupinfo['edit_reason'] = stripslashes($raw_groupinfo['edit_reason']);
$raw_groupinfo['type'] = ($raw_groupinfo['private_posts']) ? "Group Posts Are Private. " : "Group Posts Are Public. ";
$raw_groupinfo['type'] .= ($raw_groupinfo['moderate_members']) ? "Members Are Moderated. " : "";
$raw_groupinfo['type'] .= ($raw_groupinfo['hidden_group']) ? "This Group Is Hidden From Listings. " : "";
$raw_groupinfo['type'] .= ($raw_groupinfo['leaderonly_threads']) ? "Only The Group Leader Can Make Threads. " : "";
$raw_groupinfo['create_date'] = vbdate($vbulletin->options['dateformat'],$raw_groupinfo['create_date']);
$raw_groupinfo['leaderavatar'] = "<img src=\"" . $vbulletin->options['bburl'] . "/" . fetch_avatar_url($raw_groupinfo['leaderid']) . "\" alt=\"Group Leader: " . $raw_groupinfo['leadername'] . "\" />";
$raw_groupinfo['membercount'] = intval($raw_groupinfo['membercount']);
$gettotalposts = $vbulletin->db->query_read("SELECT COUNT(postid) AS totalposts FROM grps_post WHERE threadid != '' AND groupid = " . $raw_groupinfo[groupid]); // <--- this info
$raw_groupinfo['postcount'] = intval($gettotalposts['totalposts']);
$raw_groupinfo[spew] = $parsed_text = $parser->do_parse($raw_groupinfo[spew]);
if (!$raw_groupinfo['hide_image'])
{
$raw_groupinfo['image'] = ($raw_groupinfo['image_name']) ? "" . $getgroupimage . "" : "<img src=\"" . $vbulletin->options[bburl] . "/" . $stylevar[imgdir_grps] . "/grps_noimage_" . $grps_rin . ".gif\" alt=\"" . $raw_groupinfo[title] . "\" />";
}
$show['leaderoptions'] = ($raw_groupinfo['leaderid'] == $vbulletin->userinfo['userid']) ? TRUE : FALSE;
$raw_groupinfo['edit_date'] = vbdate($vbulletin->options['dateformat'], $raw_groupinfo['edit_dateline']);
$raw_groupinfo['edit_time'] = vbdate($vbulletin->options['timeformat'], $raw_groupinfo['edit_dateline']);
return $raw_groupinfo;
}
the implementation is
PHP Code:
$grps_showgroup = grps_getgroupinfo($groupid);
$grps_pagetitle = $grps_showgroup['title'];
$grps_showgroup = grps_getgroupsettings($grps_showgroup);
however, everything else works bar managing to get the postcount, any idea why?