Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
I dont care for the display which shows the number of people in the forums; I'd rather see who is actually in the forum.

So, I did another Quick Mod:

In postlist.php, around lines 493-514 I replaced that code with (the stuff in bold):

[]// Find out how many are browsing this forum
$query = "
SELECT O_Type,O_Extra,O_Username,O_Uid
FROM {$config['tbprefix']}Online
WHERE O_Extra LIKE '$Board%'
";
$sth = $dbh -> do_query($query);
$r = "";
$a = 0;
while (list($Type,$Extra,$Who,$Uid) = $dbh -> fetch_array($sth)) {
if ( $Type == "r" ) {
if ( empty($r) ) $r = "<a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o">$Who</a>";
else $r .= ", <a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o">$Who</a>";
}
else {
$a++;
}
}
if ( !empty($r) ) $r = "Users browsing this forum: $r";
if ( $a > 0 ) $r .= " (and $a anonymous users)";


// -------------------------
// Set up some sorting stuff[/]

Then in postlist.tmpl, I added the following likes in bold:

[]<!-- END OF LOOP -->
<tr>
<td colspan="6" class="tdheader">
$pagejumpers
</td></tr>
$tbclose
<br />

$tbopen
<tr>
<td class="darktable">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td class="catandforum">
<font class="small">$r</font>
</td>
</tr>
</table>
</td>
</tr>
$tbclose
<br />


$tbopen
<tr>
<td colspan="3" class="tdheader">
{$ubbt_lang['B_INFO']}[/]

Viola! I nicely formatted box with a display of the users who are browing the forum (and a link to their profiles).

Last edited by extremebikini; 04/20/2003 10:30 AM.
Sponsored Links
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
If you are really adventerous and want to allow people to remain hidden (if they so selected) and have Mods and Admins see those people in italics; replace the code in postlist.php with the following instead of the code above:

[]// Find out how many are browsing this forum
$query = "
SELECT {$config['tbprefix']}Online.O_Username,{$config['tbprefix']}Online.O_Extra,{$config['tbprefix']}Online.O_Type,{$config['tbprefix']}Users.U_Status,{$config['tbprefix']}Users.U_Visible,{$config['tbprefix']}Users.U_Number
FROM {$config['tbprefix']}Online,{$config['tbprefix']}Users
WHERE {$config['tbprefix']}Online.O_Username = {$config['tbprefix']}Users.U_Username
AND {$config['tbprefix']}Online.O_Extra LIKE '$Board%'
ORDER BY {$config['tbprefix']}Online.O_Last DESC
";
$sth = $dbh -> do_query($query);
$r = "";
$a = 0;
while (list($Who,$Extra,$Type,$Status,$Visible,$Uid) = $dbh -> fetch_array($sth)) {
if ( ($user['U_Status'] != "Administrator") && ($Visible == "no") ) {
$a++;
continue;
}

if ( ($user['U_Status'] == "Administrator" || $user['U_Status'] == "Moderator") && ($Visible == "no")) {
if ( $Type == "r" ) {
if ( empty($r) ) $r = "<strong><em><a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o">$Who</a></em></strong>";
else $r .= ", <strong><em><a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o">$Who</a></em></strong>";
}
else {
$a++;
}
continue;
}

if ( $Type == "r" ) {
if ( empty($r) ) $r = "<a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o">$Who</a>";
else $r .= ", <a href="{$config['phpurl']}/showprofile.php?Cat=$Cat&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o">$Who</a>";
}
else {
$a++;
}
}

if ( !empty($r) ) $r = "Browsing this forum: $r";
if ( $a > 0 ) $r .= " and $a anonymous users";


// -------------------------
// Set up some sorting stuff
[/]

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Schweet. Thanks Michael.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
yes, that's a great one, and relatively easy to add. thank you


- Allen wavey
- What Drives You?
Joined: Nov 2002
Posts: 116
Journeyman
Journeyman
Offline
Joined: Nov 2002
Posts: 116
I waited for this one
Thanks

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Michael I do beleive the code

$tbopen
<tr>
<td class="darktable">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td class="catandforum">
<font class="small">$r</font>
</td>
</tr>
$tbclose
</td>
</tr>
$tbclose
<br />

should be

$tbopen
<tr>
<td class="darktable">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td class="catandforum">
<font class="small">$r</font>
</td>
</tr>
</table>
</td>
</tr>
$tbclose
<br />

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Anyone know which part of this code is changed in 6.4 (from 6.3)? I would love to use this hack, as it stands in 6.4 it doesn't work.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK _ I worked this out for you.

In postlist.php

Above this:
Code
 <br />// ------------------------- <br />// Set up some sorting stuff <br />


Add this:
Code
 <br />// Find out how many are browsing this forum <br />$query = " <br />SELECT t1.O_Username,t1.O_Extra,t1.O_Type,t2.U_Status,t2.U_Visible,t2.U_Number <br />FROM {$config['tbprefix']}Online AS t1, <br />     {$config['tbprefix']}Users AS t2 <br />WHERE t1.O_Username = t2.U_Username <br />AND t1.O_Board = '$Board_q' <br />ORDER BY t1.O_Last DESC <br />"; <br />$sth = $dbh -> do_query($query); <br />$r = ""; <br />while (list($Who,$Extra,$Type,$Status,$Visible,$Uid) = $dbh -> fetch_array($sth)) { <br /> <br />if ( ($user['U_Status'] != "Administrator") && ($Visible == "no") ) { <br />     $a++; <br />     continue; <br />} <br />	if ( ($user['U_Status'] == "Administrator" || $user['U_Status'] == "Moderator") && ($Visible == "no")) { <br />		if ( $Type == "r" ) { <br />			if ( empty($r) ) $r = "<strong><em><a href=\"{$config['phpurl']}/showprofile.php?Cat=$Cat&amp;User=$Uid&amp;Board=$Board&amp;what=ubbthreads&amp;page=$page&amp;view=$view&amp;sb=$sb&amp;o=$o\">$Who</a></em></strong>"; <br />			else $r .= ", <strong><em><a href=\"{$config['phpurl']}/showprofile.php?Cat=$Cat&amp;User=$Uid&amp;Board=$Board&amp;what=ubbthreads&amp;page=$page&amp;view=$view&amp;sb=$sb&amp;o=$o\">$Who</a></em></strong>"; <br />		} <br />		continue; <br />	} <br /> <br />	if ( $Type == "r" ) { <br />		if ( empty($r) ) $r = "<a href=\"{$config['phpurl']}/showprofile.php?Cat=$Cat&amp;User=$Uid&amp;Board=$Board&amp;what=ubbthreads&amp;page=$page&amp;view=$view&amp;sb=$sb&amp;o=$o\">$Who</a>"; <br />		else $r .= ", <a href=\"{$config['phpurl']}/showprofile.php?Cat=$Cat&amp;User=$Uid&amp;Board=$Board&amp;what=ubbthreads&amp;page=$page&amp;view=$view&amp;sb=$sb&amp;o=$o\">$Who</a>"; <br />	} <br />} <br /> <br />if ( !empty($r) ) $r = "Browsing: $r"; <br /> <br />



Then in postlist.tmpl find this:
Code
 <br />$r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE4']} <br />


Change to this:
Code
 <br />$r and $a {$ubbt_lang['C_ONLINE4']} <br />

Last edited by JoshPet; 07/02/2004 1:56 PM.
Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Thanks Josh!

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Here's an alteration I made to the postlist.tmpl to add this to the top of the forum.

Find:
Code
 <br /><? //UBBTREMARK <br />echo <<<UBBTPRINT <br />


Add this just below it:
Code
 <br />$tbopen <br /><tr> <br /><td class="darktable"> <br /><table width="100%" cellpadding="3" cellspacing="0"> <br /><tr> <br /><td class="catandforum"> <br />$r and $a {$ubbt_lang['C_ONLINE4']} <br /></td> <br /></tr> <br /></table> <br /></td> <br /></tr> <br />$tbclose <br /><br /> <br />


This will put it into a formatted table for you.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I just edited my post above to fix an issue with the anonymous user count.

Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
Josh,

Usernames of those who have opted to be "invisible" are being displayed with this hack. Is anyone else noticing this too? I got several complaints from members who have invisible enabled and their usernames are appearing in the display. []http://www.the-highway.com/Smileys/wow1.gif[/]

Jeff


Artificial Intelligence is no match for natural stupidity!
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Actually - I missed one part of michael's code

After the while statement, add this:

Code
<br />if ( ($user['U_Status'] != "Administrator") && ($Visible == "no") ) {<br />     $a++;<br />     continue;<br />}<br />

Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
Thanks, that seems to have fixed the problem. Now, to spend a few days in recovery from all the stones that were thrown at me by invisible users. []http://www.the-highway.com/Smileys/rofl.gif[/]


Artificial Intelligence is no match for natural stupidity!
Joined: Jun 2003
Posts: 1,025
Junior Member
Junior Member
Offline
Joined: Jun 2003
Posts: 1,025
Invisibility is a privledge, not a right. Let this be a lesson to them.

Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
[]JoshPet said:
I just edited my post above to fix an issue with the anonymous user count. [/]
Is there a way to have the exact number of anonymous users displayed? As it is now, the usernames of registered users browsing the forum are displayed and then it simply says, "and anonymous users are browsing this forum." regardless if there are none or 20.


Artificial Intelligence is no match for natural stupidity!
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I'd double check your code, make sure you didn't accidentally remove the $a variable, which contains the anonymous count.

I did this on erics site and it does contain the number of anonymous users.

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
I did this on 6.4b1 and it removed where it shows the (3 viewing) on the forums.

Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
Perhaps the problem, which is now resolved was due to the fact that I replaced the default section below with the new stuff? Anyway, I added it back in and now all is fine.

Code
<br />// Find out how many are browsing this forum<br />   $query = "<br />      SELECT O_Type,O_Board,COUNT(*)<br />      FROM   {$config['tbprefix']}Online<br />      WHERE  O_Board = '$Board_q'<br />      GROUP BY O_Type<br />   ";<br />   $sth = $dbh -> do_query($query);<br />   $a = "0";<br />   $r = "0";<br />   while (list($Type,$Extra,$count) = $dbh -> fetch_array($sth)) {<br />      ${$Type} = $count;<br />   }<br />


Artificial Intelligence is no match for natural stupidity!
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
I have reposted this mod (for 6.4) in the modifications forum.

https://www.ubbdev.com/forum/showflat.php?Cat=0&Number=116328&page=0&vc=#Post116328

(Can a current mod, please close this thread. Thanks)


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)