1 (edited by Mark 2005-11-01 20:29)

Topic: [REQ] Last 5 Active users

i would like a mod that shows the last 5 users logged on the forum
how would i do this?

Re: [REQ] Last 5 Active users

yeah me too!

3

Re: [REQ] Last 5 Active users

ok i found the last 20 active users mod on punres.org and i think it should work if you edit it like this a little...

<!--- "Last 5 Visitors" Script by ultime (ultime@omgultime.com) created for PunBB --->
<div id="announce" class="block">
    <h2><span><b>Last 5 Visitors</b></span></h2>
    <div class="box">
        <div class="inbox">
            <div>
<?php

$result = $db->query('SELECT id, username, last_visit  FROM '.$db->prefix.'users ORDER BY num_posts DESC LIMIT 5') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
echo "tttttt".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a>('.$data['num_posts'].') '."n";
}

?>
        </div>
    </div>
</div>
</div>
<!--- End for "Last 5 active users" --->

i have edited this code a little so it should show.

4 (edited by sanjokidd 2005-11-05 10:29)

Re: [REQ] Last 5 Active users

Hey I am not sure why I get paranthasis like this

Last 5 Visitors:
URTranceZone() Guest() scb2k() <-----

www.urtrancezone.com/forum/

someone help!!!

5

Re: [REQ] Last 5 Active users

change it to this...

<!--- "Last 5 Visitors" Script by ultime (ultime@omgultime.com) created for PunBB --->
<div id="announce" class="block">
    <h2><span><b>Last 5 Visitors</b></span></h2>
    <div class="box">
        <div class="inbox">
            <div>
<?php

$result = $db->query('SELECT id, username, last_visit  FROM '.$db->prefix.'users ORDER BY num_posts DESC LIMIT 5') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
echo "".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a> '."";
}

?>
        </div>
    </div>
</div>
</div>
<!--- End for "Last 5 active users" --->

Re: [REQ] Last 5 Active users

Thanks!!!

Re: [REQ] Last 5 Active users

Where do you insert this code?  I have tried Index.php and footer.php.  I get parsing errors when I try to execute the code.

C's Daddy

Re: [REQ] Last 5 Active users

you enter this code in the index.php

Look for this towards the bottom

if ($num_users > 0)
        echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo "\t\t\t".'<div class="clearer"></div>'."\n";

}
else
    echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";


?>

then insert code below..

<!--- "Last 5 Visitors" Script by ultime (ultime@omgultime.com) created for PunBB --->
<div id="announce" class="block">
   
    <div class="box">
        <div class="inbox">
<span><b>Recent Visitors:</b></span>
            <div>
<?php

$result = $db->query('SELECT id, username, last_visit  FROM '.$db->prefix.'users ORDER BY num_posts DESC LIMIT 10') or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
echo "".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a> '."";
}

?>
        </div>
    </div>
</div>
</div>
<!--- End for "Last 5 active users" --->

9

Re: [REQ] Last 5 Active users

or what i do it put in it a .txt file in include/user and do an include were i want it using main.tpl

Re: [REQ] Last 5 Active users

Great it works!

Re: [REQ] Last 5 Active users

Got it working also.

Thanks,

C's Daddy

Re: [REQ] Last 5 Active users

Question to the people who got it working. I notice that the names do not refresh as new people log in, the old names stay and donest even show the new people who where logged in.. HELP!!!

Re: [REQ] Last 5 Active users

shouldn't it be ordered by last_visit? just wondering... it wasn't updating for me either... thx!

14

Re: [REQ] Last 5 Active users

well its for last 5 ACTIVE users, if it was last_visit it would be inactive.

Re: [REQ] Last 5 Active users

Mine never changes either.  Same order.  I tried logging on as another user id, posting and logging off.  List does not change.  By Looking at the user list when logged in as Adminstrator, it seems to be the 5 Most Active users, not the last 5 vistors.  Any suggestions to make it work right or better yet show last 5 vistors and keep the stats on the 5 most active posters.

C's Daddy

16

Re: [REQ] Last 5 Active users

yeah change the code from num_posts to last_visit