Jake Bunce
Tue 24th Aug '04, 6:35pm
Many forum admins want guests (or other users who don't have access to a private forum) to see that there are threads and posts in that forum. Under the current system, if a user doesn't have access to a forum then it will show 0 threads and 0 posts in the forum listing. You can use this method to show the true counts regardless of forum permissions.
Note, If you have a ton of forums then this code can add a lot of processing time to your forumhome and forumdisplay pages.
Go to your:
Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start
Add this code:
// IF FORUMHOME OR FORUMDISPLAY PAGE
if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')
{
// GET FORUM COUNTERS
$forumcounts= $DB_site->query("SELECT forumid, replycount, threadcount
FROM " . TABLE_PREFIX . "forum
");
// SET VALUES
while ($forumcount = $DB_site->fetch_array($forumcounts))
{
$forumreply[$forumcount[forumid]] = $forumcount[replycount];
$forumthread[$forumcount[forumid]] = $forumcount[threadcount];
}
}
Then go to your:
Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates -> forumhome_forumbit_level1_post
Replace the red code...
<td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
<td class="alt1">$forum[threadcount]</td>
<td class="alt2">$forum[replycount]</td>
<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1"><div class="smallfont">$forum[moderators] </div></td>
</if>
...with the blue code:
<td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
<td class="alt1">{$GLOBALS[forumthread][$forum[forumid]]}</td>
<td class="alt2">{$GLOBALS[forumreply][$forum[forumid]]}</td>
<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1"><div class="smallfont">$forum[moderators] </div></td>
</if>
Make a similar change to the forumhome_forumbit_level2_post template.
Note, If you have a ton of forums then this code can add a lot of processing time to your forumhome and forumdisplay pages.
Go to your:
Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start
Add this code:
// IF FORUMHOME OR FORUMDISPLAY PAGE
if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')
{
// GET FORUM COUNTERS
$forumcounts= $DB_site->query("SELECT forumid, replycount, threadcount
FROM " . TABLE_PREFIX . "forum
");
// SET VALUES
while ($forumcount = $DB_site->fetch_array($forumcounts))
{
$forumreply[$forumcount[forumid]] = $forumcount[replycount];
$forumthread[$forumcount[forumid]] = $forumcount[threadcount];
}
}
Then go to your:
Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates -> forumhome_forumbit_level1_post
Replace the red code...
<td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
<td class="alt1">$forum[threadcount]</td>
<td class="alt2">$forum[replycount]</td>
<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1"><div class="smallfont">$forum[moderators] </div></td>
</if>
...with the blue code:
<td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
<td class="alt1">{$GLOBALS[forumthread][$forum[forumid]]}</td>
<td class="alt2">{$GLOBALS[forumreply][$forum[forumid]]}</td>
<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1"><div class="smallfont">$forum[moderators] </div></td>
</if>
Make a similar change to the forumhome_forumbit_level2_post template.