Previous Thread
Next Thread
Print Thread
Rate Thread
#265493 12/28/2003 12:44 PM
Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
How would I go about adding a Users Currently Online statement to the ubbthreads.tmpl file?

What I'd like to do is put a statement of current # of users online right under their user name. The trick seems to be to get $a,$r,$totalon etc to showup. they don't appear to pass through once you're at the main index screen.

Sponsored Links
Joined: May 2006
Posts: 67
Junior Member
Junior Member
Offline
Joined: May 2006
Posts: 67
I'd also like to know if it is possible to add a hack to 6.4 which allows users to be displayed on individual forums of my choice. I thought I'd tag my question in here.

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
I was curious, so I looked into the ubbthreads.php and postlist.php files. Both of them use $a and $r variable for the user count. So you could do something like this in your ubbt_registered.tmpl file:

Code
 $r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE4']}


That's the same script that's used in the ubbthreads.tmpl file. Since the $ubbt_lang variables are in the generic.php language file that script should work for all pages (at least you'll get the words). Keep in mind that the ubbthreads.php file will generate a value for $r and $a that are for the entire forum, but the postlist.php file will generate a $r and $a that is just for the forum being viewed.

You could add your own custom language entries in the generic.php file and create unique text for your hack

#265496 12/28/2003 4:23 PM
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
[]Dunk said:
I'd also like to know if it is possible to add a hack to 6.4 which allows users to be displayed on individual forums of my choice. I thought I'd tag my question in here. [/]

Right now the number of users online is displayed on all forums. Do you want the ability to disable it?

P.S. In the future start a new thread for your question. Tagging your question on to an existing thread will guarenty that it will get lost...

Last edited by Dalantech; 12/28/2003 4:25 PM.
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
You could use this mod here

https://www.ubbdev.com/forum/showflat.php/Number/96321

Then you have these instructions here would be this

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX Search in ubbthreads.php :
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

XXXXXXXXXXXXXXXXXXXXXXX
XX Replace it with :
XXXXXXXXXXXXXXXXXXXXXX


include("$thispath/index_whosonline.php");
include("$thispath/templates/$tempstyle/ubbthreads.tmpl");


You could change this part:

include("$thispath/index_whosonline.php");
include("$thispath/templates/$tempstyle/ubbthreads.tmpl");


to somemthing like this


if ( $Board = 'forum1' ) {

include("$thispath/index_whosonline.php");

}

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


or for multiple forums


if ( ( $Board = 'forum1' ) && ( $Board = 'forum2' ) && ( $Board = 'forum1' ) ) {

include("$thispath/index_whosonline.php");

}

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


Of course your would replace the forum1 forum2 forum3 with board keywords.

Sponsored Links
Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
Exactly, thats where I was on this thing. Pulling in the text and such worked fine, Getting $r or $a or anything else seems to be the trick. I'm thinking that registerednav.tmpl is coming in before those variables are assigned. So in essence they don't exist yet.

Code
  $r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE4']}


Does exactly as advertised, gives you the text. What I'm after is the total users online to be displayed at the top of the screen, as opposed to being at the bottom. Actually in my case I don't care if it's done in both places.

Thanks for the reply, and effort.

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Yup, the ubbt_registerednav.tmpl file would be called before the variables are generated

You could move that piece of script to the top of the ubbthreads.php file -it wouldn't be in the menu, but at least it would be up at the top of the page...

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
You could add the script in the ubbthreads.php file from lines 237 to 259 (look for Let's see how many user's are viewing each forum ) to your ubbt_registerednav.tmpl file. It might be a little ugly, cause you'd be adding another database query to every page, but it should work. Remember that the templates are constructed as one big echo, so you'll have to come out of echo, execute the php script, and then go back to echoing html. Something like this:

UBBTPRINT;

Execute some php scripting here

echo <<<UBBTPRINT
now we are back to echoing out html



Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
Uggg... you're right, that'd be a load on the server wouldn't it.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Besides the fact that you would need to add more than the online code. The max online date would not display right as some more code is needed. I tried it for you and it displayed but would need more looking at to get the date time to display other than 12/31/69

Sponsored Links
Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
Thanks to both you and DalTech.

The only way I can see pulling this off is to code the registered nav to such that it would at ever instance run the numbers itself. which means a moderate hit to system resources every time someone clicks a link as that .tmpl is going to get called every chance it gets.

I'm thinking it may be a better idea to add a table row to the forums list and bring it in there?

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
That works quite well

At the top of ubbthreads.tmpl after the $tbopen add this

<tr>
<td colspan="5" class="darktable">
{$ubbt_lang['C_ONLINE']} $r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE3']}
<br />
{$ubbt_lang['MAX_ONLINE']} $c_maxonline @ $maxonlinetime
<br />
</td>
</tr>

Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
That worked pretty good. I had just tried this..

$tbopen
There are currently $r {$ubbt_lang['C_ONLINE2']} $a anonymous users online.
$tbclose

right after the $only_favs and prior to the $tbopen.

Creating a seperate table for the number of users currently online.


Thanks for helping me walk through this. Every little bit helps in the overall understanding of where and how things work.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
well your missing some html in that statement

try this above the tbopen

$tbopen
<tr>
<td colspan="5" class="darktable">
{$ubbt_lang['C_ONLINE']} $r {$ubbt_lang['C_ONLINE2']} $a {$ubbt_lang['C_ONLINE3']}
<br />
{$ubbt_lang['MAX_ONLINE']} $c_maxonline @ $maxonlinetime
<br />
</td>
</tr>
$tbclose
<br />

You can remove this part if you dont want the maxonline there

<br />
{$ubbt_lang['MAX_ONLINE']} $c_maxonline @ $maxonlinetime

Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
OH YEah! thats MUCH better, Thanks.


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)