PDA

View Full Version : Users Browsing this Thread problem


TECK
04-01-2002, 12:36 PM
this is the code i made in showthread.php, right before the dooutput():// Get users browsing this thread
if ($showforumusers) {
$threaddatecut = $ourtimenow - $cookietimeout;
$threadbrowsers = '';
$threadcoma = '';
$threadusers = $DB_site->query("SELECT username, invisible, userid
FROM user
WHERE inforum = $thread[threadid]
AND lastactivity > $threaddatecut
AND lastvisit <> lastactivity");
while ($threaduser = $DB_site->fetch_array($threadusers)) {
if ((!$threaduser['invisible'] or $bbuserinfo['usergroupid'] == 6) and $bbuserinfo['userid'] != $threaduser['userid']) {
$loggeduserid = $threaduser['userid'];
$loggedusername = $threaduser['username'];
if ($threaduser['invisible'] == 1) {
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$threadbrowsers .= \"".$threadcoma.gettemplate('showthread_loggedinuser' )."\";");
$threadcoma = ', ';
}
}

if ((!$bbuserinfo['invisible'] or $bbuserinfo['usergroupid'] == 6) and $bbuserinfo['userid'] <> 0) {
$loggeduserid = $bbuserinfo['userid'];
$loggedusername = $bbuserinfo['username'];
if ($bbuserinfo['invisible'] == 1) {
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$threadbrowsers .= \"".$threadcoma.gettemplate('showthread_loggedinuser' )."\";");
}
if ($threadbrowsers) {
eval("\$loggedusers .= \"".gettemplate('showthread_loggedinusers')."\";");
}
}for some reason, it will grab only one user at the time. is all in the query my bug. can you help me to understand where resides the problem?

TECK
04-01-2002, 12:39 PM
i also tried this:
i replaced:WHERE inforum = $thread[threadid]withWHERE inforum = $thread[forumid]but now it shows all the users frowsing the forum, not the thread. any help will be apreciated.

UPDATE: Unfortunatelly, i dont have a live website to test my hacks. i only have a localhost setup where i run all my tests, with no users but me that can connect and browse. that's why i always had problems releasing proper hacks.
i will signup with a host in about one month or two and go live with a website. in this way there should be no more problems. for now, i would like to solve this issue mentioned above. thank you

UPDATE 2: ather looking at firefly's code, i realised how close i was to make it work this hack. :(
as you say firefly, life aint fair. ;) my failure to make this hack made me learn one new thing. thanks alot. :D