This is the functions.php file code that I added. Quite simple, really, and I highlighted the additions so you can see them quickly:
Code:
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('cache_ordered_forums')) ? eval($hook) : false;
// get subscribed forums too
if ($userid)
{
$query = "
SELECT subscribeforumid, $counter_select $hook_query_fields
". iif($vbulletin->options['threadmarking'], ', forumread.readtime AS forumread') . "
FROM " . TABLE_PREFIX . "forum AS forum
LEFT JOIN " . TABLE_PREFIX . "subscribeforum AS subscribeforum ON (subscribeforum.forumid = forum.forumid AND subscribeforum.userid = $userid)
" . iif($vbulletin->options['threadmarking'], " LEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = forum.forumid AND forumread.userid = $userid)") . "
$tachyjoin
$hook_query_joins
";
}
// just get counters
else
{
$query = "
SELECT $counter_select $hook_query_fields
". iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], ', forumread.readtime AS forumread') . "
FROM " . TABLE_PREFIX . "forum AS forum
" . iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = forum.forumid AND forumread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
$tachyjoin
$hook_query_joins
";
}
}
It's that simple in the functions file. My plugin is pretty simple too:
Code:
$hook_query_fields = ",`ForumDetails`.`Details_UID`,
`ForumDetails`.`Clean_Name`,
`ForumDetails`.`forumid`,
`ForumDetails`.`Information1`,
`ForumDetails`.`Information2`,
`ForumDetails`.`Information3`";
$hook_query_joins = "LEFT JOIN " . TABLE_PREFIX . "ForumDetails ON (ForumDetails.forumid = forum.forumid)";
That's pretty much it. The plugin is tied to: cache_ordered_forums and does allow me to show the 'ForumDetails'.
However - all the stats seem to disappear. They are there and when the query is joined I can see all the same information as I do without the plugin. I ran both queries in an analyzer and the same data is returned in both queries