Quote:
Originally Posted by freddie
Fixed for Gold. Try this:
PHP Code:
else
{ // imodcache is not set - do a query
if (isset($modcache["$userid"]))
{
return $modcache["$userid"];
}
$modcache["$userid"] = 0;
DEVDEBUG('QUERY: is the user a moderator (any forum)?');
$ismod_all = $DB_site->query("SELECT moderatorid, permissions FROM " . TABLE_PREFIX . "moderator WHERE userid = $userid");
while ($ismod = $DB_site->fetch_array($ismod_all))
{
if ($do)
{
if ($ismod['permissions'] & $_BITFIELD['moderatorpermissions']["$do"])
{
$modcache["$userid"] = 1;
break;
}
}
else
{
$modcache["$userid"] = 1;
break;
}
}
return $modcache["$userid"];
}
As for can_moderate generating a query on many pages for non admins/supermods, I didn't even realize that was happening. I don't think that is really acceptable so we will see what we can do about it.
|
Oops I see that could have a problem if you call can_moderate() on the same user using different 'do' actions. I'll have to fix that one but this should get you by.