Quote:
Originally Posted by Reverend
Like Linear Helix mentioned earlier.
Is there anyway to make it so that the totals only show threads/posts forums that users have permission to view.
i.e if a member posts in a private forum,the total only goes up for other users that have permission to view it.
Would solve any possible complaints from members when the stats show new threads/posts have been made,but when they click on "new posts" the totals don't match.
BTW, clicks Install.
|
you can use something like this:
PHP Code:
// to check permissions for different users in forums
$forumids = array_keys($forumcache);
foreach($forumids AS $key => $value)
{
$fperms = &$bbuserinfo['forumpermissions']["$forumid"];
$forum = &$forumcache["$forumid"];
if (!($fperms & CANVIEW) OR !($fperms & CANSEARCH) OR !verify_forum_password($forumid, $forum['password'], false))
{
// get rid of the forumids that the user doesnt have permission to view
unset($forumids["$key"]);
}
}
Then you add (new threads count in this case) ,
PHP Code:
$getnewthread=$DB_site->query_first("
SELECT COUNT(*) AS threads
FROM ".TABLE_PREFIX."thread
WHERE lastpost IN(" . implode(', ', $forumids) . ") > '".$bbuserinfo['lastvisit']."'
");
as the query.