you can decreasing the ammount of queries by adding some sort of hashing:
instead of
PHP Code:
$userinfo=$DB_site->query_first("SELECT username,usergroupid FROM user WHERE userid=".$thread['postuserid']);
if($userinfo['usergroupid']==6) $special="<font color=#cc0000><b><i>";
elseif ($userinfo['usergroupid']==5) $special="<font color=green><b>";
elseif ($userinfo['usergroupid']==7) $special="<font color=green><b>";
try to use this:
PHP Code:
if(!isset($userinfo[$thread[postuserid]])) $userinfo[$thread[postuserid]]=$DB_site->query_first("SELECT username,usergroupid FROM user WHERE userid=".$thread['postuserid']);
if($userinfo[$thread[postuserid]]['usergroupid']==6) $special="<font color=#cc0000><b><i>";
elseif ($userinfo[$thread[postuserid]]['usergroupid']==5) $special="<font color=green><b>";
elseif ($userinfo[$thread[postuserid]]['usergroupid']==7) $special="<font color=green><b>";
should work, but not tested