ya, all forums are open for guests except for one. the reason they are coming up with 0 is because before i start to grab the info i set the 2 variables to 0. however, i don't think it matters if the forums are open to guests or not because it is just grabbing the stats from the forum. inside the $forumcache there is alot of information regarding each individual forum. it should contain that information no matter what your status is on the site. it should all be the same.
atleast that is what i assume from looking over the code.
it's just weird that it works on index.php but the same exact code with the same included files doesn't work because those 2 pieces are missing from $forumcache.
i figured it out. i got some help and i dug around in the code a bit and figured it all out.
for anyone else that is curious.
PHP Code:
cache_ordered_forums(1); // <-- I was missing this line, very important!
$totalthreads = 0;
$totalposts = 0;
if (is_array($forumcache))
{
foreach ($forumcache AS $forum)
{
$totalthreads += $forum['threadcount'];
$totalposts += $forum['replycount'];
}
}
$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);