Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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
Attachments
49492-whosonline.6.1.zip (0 Bytes, 31 downloads)

Sponsored Links
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
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.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
you might try

{$config['phpurl']}

instead


- Allen wavey
- What Drives You?
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
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


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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


- Allen wavey
- What Drives You?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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!

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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

Last edited by JoshPet; 06/15/2002 12:49 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
So it looks like attached screen shot when complete.
[]https://www.ubbdev.com/threads/php/uploads/50015-hack.gif[/]
Attachments
50015-hack.gif (0 Bytes, 48 downloads)

Last edited by JoshPet; 06/14/2002 10:38 PM.
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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!
Attachments
50205-screen.gif (0 Bytes, 41 downloads)

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Here's the updated code.
Attachments
50389-whosonline.6.2.zip (0 Bytes, 40 downloads)

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That does the trick!
Thanks Dave!

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Your Welcome

Joined: Mar 2002
Posts: 147
Member
Member
Offline
Joined: Mar 2002
Posts: 147
Which one of things doesn't look like the other?

[]https://www.ubbdev.com/threads/php/uploads/50805-wosonline.gif[/]
Attachments
50805-wosonline.gif (0 Bytes, 30 downloads)

Last edited by casper; 06/21/2002 3:48 PM.
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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.


Joined: May 1999
Posts: 78
Member
Member
Offline
Joined: May 1999
Posts: 78
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

Joined: May 1999
Posts: 78
Member
Member
Offline
Joined: May 1999
Posts: 78
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

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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.


- Allen wavey
- What Drives You?
Joined: Nov 2000
Posts: 210
Member
Member
Offline
Joined: Nov 2000
Posts: 210
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

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Shouldn't be to hard to do. I'll take a look right now and see where it should go.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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

Joined: Nov 2000
Posts: 210
Member
Member
Offline
Joined: Nov 2000
Posts: 210
thanks Dave

Joined: Nov 2000
Posts: 210
Member
Member
Offline
Joined: Nov 2000
Posts: 210
Works Like a Champ. Thanks a bunch

Pappy

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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!

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
No hurry.

You're awesome.

Thanks!
Josh

Joined: Aug 2002
Posts: 51
Power User
Power User
Offline
Joined: Aug 2002
Posts: 51
working great on ubbt6.1b1

no troubles at all

Last edited by webwolfe; 08/25/2002 9:40 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Cool.... I haven't added this into my 6.1 yet and wondered if there would need to be any tweaking.

Joined: Aug 2002
Posts: 51
Power User
Power User
Offline
Joined: Aug 2002
Posts: 51
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!

Joined: Sep 2002
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 8
Which file do I find

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

to this one:

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

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.

Joined: Sep 2002
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 8
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

Joined: Sep 2002
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 8
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.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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.
Attachments
55912-WhosOnlineBoxJosh.txt (0 Bytes, 53 downloads)

Joined: Sep 2002
Posts: 8
Lurker
Lurker
Offline
Joined: Sep 2002
Posts: 8
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 */ ?>

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Wow.....
Your template is EXACTLY like mine.... I compared them.

What is happening for the registered users?
Do you have a link?

Page 1 of 2 1 2

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
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
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)