 |
 |
 |
 |
#243300 - 04/19/03 12:38 AM
Quick Mod: Users Browsing This Forum
|
Hacker
Registered: 02/03/02
Posts: 989
Add to del.icio.us
Digg it
|
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. <br /> <br />So, I did another Quick Mod: <br /> <br />In postlist.php, around lines 493-514 I replaced that code with (the stuff in bold): <br /> <br />[]// Find out how many are browsing this forum <br /> $query = " <br /> SELECT O_Type,O_Extra,O_Username,O_Uid <br /> FROM {$config['tbprefix']}Online <br /> WHERE O_Extra LIKE '$Board%' <br /> "; <br /> $sth = $dbh -> do_query($query); <br /> $r = ""; <br /> $a = 0; <br /> while (list($Type,$Extra,$Who,$Uid) = $dbh -> fetch_array($sth)) { <br /> if ( $Type == "r" ) { <br /> 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>"; <br /> 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>"; <br /> } <br /> else { <br /> $a++; <br /> } <br /> } <br /> if ( !empty($r) ) $r = "Users browsing this forum: $r"; <br /> if ( $a > 0 ) $r .= " (and $a anonymous users)"; <br /> <br />// ------------------------- <br />// Set up some sorting stuff[/] <br /> <br />Then in postlist.tmpl, I added the following likes in bold: <br /> <br />[]<!-- END OF LOOP --> <br /><tr> <br /><td colspan="6" class="tdheader"> <br />$pagejumpers <br /></td></tr> <br />$tbclose <br /><br /> <br /> <br />$tbopen <br /><tr> <br /><td class="darktable"> <br /><table width="100%" cellpadding="3" cellspacing="0"> <br /><tr> <br /><td class="catandforum"> <br /><font class="small">$r</font> <br /></td> <br /></tr> <br /></table> <br /></td> <br /></tr> <br />$tbclose <br /><br /> <br /> <br />$tbopen <br /><tr> <br /><td colspan="3" class="tdheader"> <br />{$ubbt_lang['B_INFO']}[/] <br /> <br />Viola! I nicely formatted box with a display of the users who are browing the forum (and a link to their profiles).
Edited by extremebikini (04/20/03 10:30 AM)
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#243301 - 04/19/03 12:59 AM
Re: Quick Mod: Users Browsing This Forum
[Re: gailg]
|
Hacker
Registered: 02/03/02
Posts: 989
|
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:<br /><br />[]// Find out how many are browsing this forum<br /> $query = "<br /> 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<br /> FROM {$config['tbprefix']}Online,{$config['tbprefix']}Users<br /> WHERE {$config['tbprefix']}Online.O_Username = {$config['tbprefix']}Users.U_Username<br /> AND {$config['tbprefix']}Online.O_Extra LIKE '$Board%'<br /> ORDER BY {$config['tbprefix']}Online.O_Last DESC<br /> ";<br /> $sth = $dbh -> do_query($query);<br /> $r = "";<br /> $a = 0;<br /> while (list($Who,$Extra,$Type,$Status,$Visible,$Uid) = $dbh -> fetch_array($sth)) {<br /> if ( ($user['U_Status'] != "Administrator") && ($Visible == "no") ) {<br /> $a++;<br /> continue;<br /> }<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&User=$Uid&Board=$Board&what=ubbthreads&page=$page&view=$view&sb=$sb&o=$o\">$Who</a></em></strong>";<br /> 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>";<br /> }<br /> else {<br /> $a++;<br /> }<br /> continue; <br /> }<br /> <br /> if ( $Type == "r" ) {<br /> 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>";<br /> 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>";<br /> }<br /> else {<br /> $a++;<br /> } <br /> }<br /> <br /> if ( !empty($r) ) $r = "Browsing this forum: $r";<br /> if ( $a > 0 ) $r .= " and $a anonymous users";<br /> <br />// -------------------------<br />// Set up some sorting stuff<br />[/]
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#243307 - 07/01/04 08:38 PM
Re: Quick Mod: Users Browsing This Forum
[Re: BlarC]
|
I type Like navaho
Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
|
OK _ I worked this out for you. <br /> <br />In postlist.php <br /> <br />Above this: <br /> <br />// ------------------------- <br />// Set up some sorting stuff <br /> <br /> <br />Add this: <br /> <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 /> <br /> <br /> <br />Then in postlist.tmpl find this: <br /> <br />$r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE4']} <br /> <br /> <br />Change to this: <br /> <br />$r and $a {$ubbt_lang['C_ONLINE4']} <br />
Edited by JoshPet (07/02/04 01:56 PM)
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#243308 - 07/01/04 08:42 PM
Re: Quick Mod: Users Browsing This Forum
[Re: Daine]
|
Junior Member
Registered: 05/12/03
Posts: 1109
|
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|