UBB.Dev
Posted By: JustDave [UBBT 6.0] Who's Online Box v6.1 - 06/10/2002 10:06 PM
There was some cause for alarm as the "Who's Online" box information did not match the extra information listed at the bottom of ubbthreads.php and this was taken to be an error.

It's not an error though. The information at the bottom includes users that are invisible so the number may be greater than the online box. I have attached an updated "Who's Online" box to include the invisible users.

This version seems to be working. I tested it on my main site's 5.4.6 threads version and it worked fine. (I did write it for 6.0 though)

Let me know what you think. I still don't know if I like the way it lays out but after a number of different attempts I stuck with this one. smile

Attached File
49492-whosonline.6.1.zip  (31 downloads)
Posted By: Ian_W Re: [UBBT 6.0] Who's Online Box v6.1 - 06/11/2002 5:51 PM
Thanks Dave.

Question:-

I added <a href = "$phpurl/online.php?Cat=$Cat" $target>{$ubbt_lang['WHO_ON']}</a> before the who's online bit so that we have a link, but the URL is going back to the top level of my domain, rather than the threads directory.

I copied this straight from the registered_nav template, so I would have thought it should have worked.

Any thoughts as to why it is not? It seems like $phpurl is not being picked up.

Ian.
Posted By: AllenAyres Re: [UBBT 6.0] Who's Online Box v6.1 - 06/11/2002 7:27 PM
you might try

{$config['phpurl']}

instead
Posted By: Ian_W Re: [UBBT 6.0] Who's Online Box v6.1 - 06/11/2002 8:01 PM
Thank you. Worked fine.

But why would it be a different command to what is in the registered_nav.tmpl (he says trying to learn )

Ian
Posted By: AllenAyres Re: [UBBT 6.0] Who's Online Box v6.1 - 06/11/2002 8:13 PM
Some scripts have at the top

$phpurl = {$config['phpurl']}

some don't, but that's why... I am not sure why one is used in some places and not all, but Dave will probably be along before long and set me straight
Posted By: AllenAyres Re: [UBBT 6.0] Who's Online Box v6.1 - 06/13/2002 6:11 AM
this one's layout seems a bit odd and a bit wordy in seperating out the invisible members, I think maybe the 6.0 version seemed a bit better. Also, when logged out, the guest only sees something like "2 guests browsing in the last 10 min" where as the 6.0 version said "There are 4 members and 2 guests browsing this forum in the last 10 min" (the new one completely leaves off the member count for guests/non-logged-in members

Nice work tho, really makes a difference I think
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 06/15/2002 1:55 AM
Hey Dave/ Allen,

We talked a bit about this in the other thread.... but *IF* I wanted to put this in the ubbt_registerednav.tmpl file... I know the coding would need to go into a different place. Allen suggested in the ubbt.inc.php file. But I tried several logical (to non-programmer me) places and it didn't work. Any idea where?

I was thinking about putting it in the registerednav.tmpl file because I think it would be cool to always see that.. when viewing a list of posts, or making a post etc..

**OR** Maybe you guys know better that it would produce way too many queries and not be practical. I wouldn't attempt it if you guys honestly thought it wasn't practical. I just don't know much about how many queries things generate etc... Dave you seem to be pretty knowledgeable from your work with the index page.

Thanks!
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 06/15/2002 4:15 AM
Hi Josh,

This will produce only 2 queries.

To get this to work on all pages that use the send_header function you will need to change this line:

$LastOn = $html -> get_date() - 600;

to this one:

$LastOn = $this -> get_date() - 600;

and then place the code inside of the send_header function of their ubbt.inc.php script below this:
code:

// -------------------------------------------------
// Are we showing the user list to reged users only?
if ( ($config['userlist'] == 2) || ($config['userlist'] == 1) ){
$template['members_link'] = " | <a href="$phpurl/showmembers.php?Cat=$Cat&page=1" $target>{$ubbt_lang['USER_LIST']}</a>";
}




Ok now in your registerednav.tmpl place this code:


echo <<<UBBTPRINT
<table width="{$theme['tablewidth']}" align="center" cellspacing="1" cellpadding="1">
<tr>
<td>
<table width="100%" align="center" class="tableborders" cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}">
<tr>
<td class="lighttable" align="center">
$whosOnline
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
UBBTPRINT;


at the bottom, between:

UBBTPRINT;

and

/* UBBTREMARK */ ?>


and now you should have the "Who's Online Box" on every page that displayes the registered navigational bar.

Upload and Enjoy
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 06/15/2002 5:33 AM
Thanks Dave!

This is awesome!!! Thank you... I was nowhere close in ubbt.inc.php

I did make a change to the ubbt_registerd.tmpl to make the Who's online box appear, attached, below the text menu...
in the same place that the language flags appear. But I only display language flags for UNregisterd users...
registerd users will have the who's online in that space.

I pasted this:

<table width="100%" align="center" class="tableborders" cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}">
<tr>
<td class="lighttable" align="center">
$whosOnline
</td>
</tr>
</table>
</td>
</tr>
</table>


Just after this:

{$template['members_link']}
</td>
</tr>


in my ubbt_registerd.tmpl file

This looks cool. Now since I was on such a streak, I decided to add the words "who's Online:" before the text so that I could remove the "who's online" link from the menu....

I replaced the very last line of Dave's code in ubbt.inc.php to this:
$whosOnline = "<a href = "{$config['phpurl']}/online.php?Cat=$Cat" $target>Who's Online:</a> $InvMembsOnline$VisMembsOnline$AnonsOnline have been online with in the last 10 minutes.";


Then removed the "Who's Online" link from the normal menu in ubbt_registerd.tmpl

Just delete this:

|
<a href = "$phpurl/online.php?Cat=$Cat" $target>{$ubbt_lang['WHO_ON']}</a>





Thanks for your help on this. I'm sure this looks very simple to y'all. But I was pretty proud.
Josh
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 06/15/2002 5:37 AM
So it looks like attached screen shot when complete.
[]https://www.ubbdev.com/threads/php/uploads/50015-hack.gif[/]

Attached picture 50015-hack.gif
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 06/17/2002 8:20 AM
Hey Dave,
Little bug...
I looked at the code, but can't figure what might be wrong.

See the attached screen shot... but it seems to leave a comma out of the invisible members. Visable works fine.

Probably missing a character or something.
Thanks!

Attached picture 50205-screen.gif
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 06/17/2002 8:23 AM
Thanks for the tip.


I'll look over the code and post the fix tomorrow night. I'm headed to bed now. Actualy will post later tonight I guess as it's already the next day. LoL
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 06/18/2002 3:02 AM
Ok I think I found the bug causing the missing coma.

Find this code:
code:


if ( ($user['U_Status'] == "Administrator") && ($palVisible == "no")) {
if ($TotalInv <= 15) {
$InvMembersOnline .= "<a href="{$config[phpurl]}/showprofile.php?Cat=$Cat&User=$codedUsername&what=$phpSelf">$palUsername</a>";
if ($coma1) {
$InvMembersOnline .= ", ";
}
$coma1++;
}
continue;
}



and change it to this:

code:


if ( ($user['U_Status'] == "Administrator") && ($palVisible == "no")) {
if ($TotalInv <= 15) {
if ($coma1) {
$InvMembersOnline .= ", ";
}
$coma1++;
$InvMembersOnline .= "<a href="{$config[phpurl]}/showprofile.php?Cat=$Cat&User=$codedUsername&what=$phpSelf">$palUsername</a>";
}
continue;
}




I think that will fix it.

I'll post the new file shortly.
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 06/18/2002 3:08 AM
Here's the updated code.

Attached File
50389-whosonline.6.2.zip  (40 downloads)
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 06/18/2002 7:54 AM
That does the trick!
Thanks Dave!
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 06/18/2002 7:58 AM
Your Welcome
Posted By: casper_dup1 Re: [UBBT 6.0] Who's Online Box v6.1 - 06/21/2002 10:46 PM
Which one of things doesn't look like the other?

[]https://www.ubbdev.com/threads/php/uploads/50805-wosonline.gif[/]

Attached picture 50805-wosonline.gif
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 06/24/2002 3:38 PM
That is because one counts the "invisible" members. The latest version (6.1) of this modification includes counting these users so it will match up.

Allen is not using the latest version here so the numbers don't match.

Posted By: lcantey Re: [UBBT 6.0] Who's Online Box v6.1 - 06/27/2002 7:56 AM
That doesn't explain the mismatch I see in guests. Right now it tells me both 1 and 2 guest/anon users. As a note, I've noticed when the count is wrong it is quite often double the expected count. Not always..but I'd say the majority of the time.

Lee
Posted By: lcantey Re: [UBBT 6.0] Who's Online Box v6.1 - 06/27/2002 7:57 AM
That doesn't explain the mismatch I see in guests. Right now it tells me both 1 and 2 guest/anon users. As a note, I've noticed when the count is wrong it is quite often double the expected count. Not always..but quite often, just a note.

Lee
Posted By: AllenAyres Re: [UBBT 6.0] Who's Online Box v6.1 - 06/27/2002 8:04 AM
the numbers match once you hit the who's online page and come back to the forum summary page. For some reason, the part you see that's in the base code for threads (the top line that doesn't mention names) doesn't get updated until you visit the who's online page then come back. The part that JustDave did is accurate.
Posted By: Pappy Re: [UBBT 6.0] Who's Online Box v6.1 - 07/07/2002 10:11 PM
Hi Dave,

This is a great Hack! Is there anyway to get it to show on the Categories pages when users are using categories View? (the default for my web site is categorie view)

Thanks
Pappy
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 07/07/2002 10:24 PM
Shouldn't be to hard to do. I'll take a look right now and see where it should go.
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 07/07/2002 10:41 PM
The instructions for ubbthreads.tmpl will work for categories.tmpl

The ubbthreads.php instructions differ. Just place the code used in ubbthreads.php into your categories.php script above this line:

include ("$thispath/templates/$tempstyle/categories.tmpl");



I hope this makes sense... lol
Posted By: Pappy Re: [UBBT 6.0] Who's Online Box v6.1 - 07/07/2002 10:44 PM
thanks Dave
Posted By: Pappy Re: [UBBT 6.0] Who's Online Box v6.1 - 07/07/2002 10:52 PM
Works Like a Champ. Thanks a bunch

Pappy
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 07/07/2002 10:54 PM
Your welcome

I think I'll add them instructions into that latest attachment, 6.2, and post to the finished modifications board. I haven't heard of any more problems with this hack.
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 08/21/2002 4:11 AM
Hey Dave,
I'm using this hack....at the top of every page as I posted here in this thread.

My chatroom is inside a php page (chat.php) and thus "who's Online" shows "In the Chatroom".

Is there a way...... in that hack on each page.... to show the number of users on the "chat.php" page, using Who's Online Data.

For example:

6 Visible members (joe, smith, bob, john, pete, dave) and 3 guests have been online in the last 10 minutes. 3 people are in the chatroom right now.

Or...

6 Visible members (joe, smith, bob, john, pete, dave) and 3 guests have been online in the last 10 minutes. 3 people (bob, john, pete)are in the chatroom right now.


Just a thought.
Seems doable... but beyond me.
Would that add too many queries to make it worth while?

thanks!
Posted By: JustDave Re: [UBBT 6.0] Who's Online Box v6.1 - 08/21/2002 4:58 AM
Counting the number of users on the specific page should be easy enough to do. That will add one more query. I'll have to look at the code before I can say what needs to go where.
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 08/21/2002 6:13 AM
No hurry.

You're awesome.

Thanks!
Josh
Posted By: webwolfe_dup1 Re: [UBBT 6.0] Who's Online Box v6.1 - 08/26/2002 4:26 AM
working great on ubbt6.1b1

no troubles at all
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 08/26/2002 4:29 AM
Cool.... I haven't added this into my 6.1 yet and wondered if there would need to be any tweaking.
Posted By: webwolfe_dup1 Re: [UBBT 6.0] Who's Online Box v6.1 - 08/26/2002 5:04 AM
well, I did add the class="tablesurround" into the 2nd line:

<table width="{$theme['tablewidth']}" align="center" class="tablesurround" cellspacing="1" cellpadding="1">

so that the table matched all the others on my page, but thats just cosmetics

I love the accuracy of this thing!
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/05/2002 7:28 AM
Which file do I find

$LastOn = $html -> get_date() - 600;

to this one:

$LastOn = $this -> get_date() - 600;???
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/05/2002 7:55 AM
If you want it to appear on every page.. .like I did. Then the line you need to change is in the code that you will be inserting into ubbt.inc.php.

So look at the code you need to paste (I believe) above the send header function.. and change that one line.

If you are just using it the standard way.. .like you see here, then no change is necessary.
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/06/2002 7:11 AM
Im having one hell of a time with this.

Heres the error thats popping up

Parse error: parse error in /home/http/mydomain.com/html/threads/ubbt.inc.php on line 336

Fatal error: Call to undefined function: getmicrotime() in /home/http/mydomain.com/html/threads/main.inc.php on line 16
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/06/2002 7:31 AM
actually nevermind the last error, it stopped popping up. But now im not getting anything. The code is in the ubbt.inc.php and ubbt_registered.tmpl like you guys specified, but all I see is a thin narrow bar.
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/06/2002 7:39 AM
I'm using it like this, at the top of every page:
[]https://www.ubbdev.com/threads/php/uploads/50015-hack.gif[/]

My down and dirty tweaked instructions to do this are attached to this post!
Hope that helps.

Attached File
55912-WhosOnlineBoxJosh.txt  (53 downloads)
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/07/2002 11:51 PM
Josh its working for the unregistered users but once I login, it stops working. Heres what my ubbt_registerednav.tmpl looks like. I inserted the code just like I did for the ubbt_unregisterednav.tmpl

<? //UBBTREMARK
echo <<<UBBTPRINT
<table width="{$theme['tablewidth']}" align="center" class="tablesurround" cellpadding="1" cellspacing="1">
<tr>
<td>
<table width="100%" class="tableborders" cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}">
<tr>
<td align="center" class="menubar">
$privateslink
$adminlink
<a href = "$phpurl/$FrontPage.php?Cat=$Cat" $target>{$ubbt_lang['FORUM_IND']}</a>
|
<a href = "$phpurl/search.php?Cat=$Cat" $target>{$ubbt_lang['TEXT_SEARCH']}</a>
|
<a href = "$phpurl/login.php?Cat=$Cat" $target>{$ubbt_lang['CONTROL_PANEL']}</a>
|
<a href = "$phpurl/online.php?Cat=$Cat" $target>{$ubbt_lang['WHO_ON']}</a>
|
<a href = "$phpurl/$ubbt_language.php?Cat=$Cat" $target>{$ubbt_lang['FAQ_TEXT']}</a>
|
<a href = "$phpurl/logout.php?Cat=$Cat" $target>{$ubbt_lang['LOGOUT_TEXT']}</a>
{$template['members_link']}
</td>
</tr>
<table width="100%" align="center" class="tableborders" cellpadding="{$theme['cellpadding']}" cellspacing="{$theme['cellspacing']}">
<tr>
<td class="lighttable" align="center">
$whosOnline
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
UBBTPRINT;
/* UBBTREMARK */ ?>
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/07/2002 11:57 PM
Wow.....
Your template is EXACTLY like mine.... I compared them.

What is happening for the registered users?
Do you have a link?
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 2:32 AM
Heres a couple of screenshots of whats going on. The non logged in users see it fine. Everything works fine. The logged in users do not. I just get a bar displayed under my nav menu. When I restore my ubbt_registerednav.php to the original provided by infopop, that bar is gone. Ill email you a link.

PS Theres an error in my screenshot. The second line should say user who HAS logged in. Not user who was not logged in.


Attached picture 56119-Untitled-1.jpg
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 2:41 AM
That's very strange.

Try this (attached).

Attached File
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 10:02 PM
Nope. Same thing.
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 10:09 PM
You're not using Netscape 4.6 are you?

Do you have a link where I can go and see.

The template I attached to my post was a working template for the registered nav bar taken right from my site.

If that doesn't work... it's got to be something other than the template.... but it works for you unrgistered nav. so all else must be in the right place.
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 10:14 PM
No, im using IE. Check it out. Its at http://community.sexnet.com/threads/ubbthreads.php
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 10:30 PM
Check the code that you put into the ubbt.inc.php file.

It does seem to be working on the unregistered template.... but it's not working correctly. When I was on.. there was a test user + myself (anon) and it only said "1 guest".

Something isn't working correctly I think with ubbt.inc.php.

Make sure you've plugged that code in the right place....
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/08/2002 10:47 PM
[]No, im using IE. Check it out. Its at http://community.sexnet.com/threads/ubbthreads.php


I don't think this should make a difference.. but take the trailing slash off your Forum URL in your config file... as soon as you click anywhere you get an extra slash in the URL before the word threads.

http://community.sexnet.com//threads/online.php?Cat=
Posted By: stevet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/09/2002 5:52 AM
[]
Quote:


No, im using IE. Check it out. Its at http://community.sexnet.com/threads/ubbthreads.php




I don't think this should make a difference.. but take the trailing slash off your Forum URL in your config file... as soon as you click anywhere you get an extra slash in the URL before the word threads.

http://community.sexnet.com//threads/online.php?Cat=


Thanks for the headsup. I thought that looked a little funny.
Heres part of my ubbt.inc.php file. I inserted the code starting at line 335 running through 447.

Its directly below

// -------------------------------------------------
// Are we showing the user list to reged users only?
if ($config['userlist'] == '1'){
$template['members_link'] = " | <a href="$phpurl/showmembers.php?Cat=$Cat&page=1" target="_top">{$ubbt_lang['USER_LIST']}</a>";
}
// ============================== who's online start ==============================================

and directly above


// ============================== who's online end ================================================

// -------------------------------------------
// Now require the registerednav.php template
include("$thispath/templates/$tempstyle/ubbt_unregisterednav.tmpl");

Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/09/2002 8:20 AM
Wow.. that's right.....

And the first online of the Who's online part of it begins with:

$LastOn = $this -> get_date() - 600;


That was the only part of that code that changed when using it on every page.
Posted By: msula Re: [UBBT 6.0] Who's Online Box v6.1 - 09/28/2002 5:03 AM
does this work for 6.1 or no?
Posted By: JoshPet Re: [UBBT 6.0] Who's Online Box v6.1 - 09/28/2002 5:14 AM
Working like a charm in 6.1... has been since b1.

I'm using it on every page..... but that's only one "tweak" from what Dave posted.

Posted By: msula Re: [UBBT 6.0] Who's Online Box v6.1 - 09/28/2002 5:22 AM
Thanks. I had a few free minutes tonight and was wondering what to add to my site. I guess I have an answer
© UBB.Developers