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?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → [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?
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.
Hey I am not sure why I get paranthasis like this
Last 5 Visitors:
URTranceZone() Guest() scb2k() <-----
someone help!!!
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" --->
Thanks!!!
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
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" --->
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
Got it working also.
Thanks,
C's Daddy
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!!!
shouldn't it be ordered by last_visit? just wondering... it wasn't updating for me either... thx!
well its for last 5 ACTIVE users, if it was last_visit it would be inactive.
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
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → [REQ] Last 5 Active users
Powered by PunBB, supported by Informer Technologies, Inc.