FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Total users online
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Total users online [message #11993] Thu, 24 July 2003 18:50 Go to next message
ctbk is currently offline  ctbk   Italy
Messages: 142
Registered: April 2002
Location: Milan, Italy
Karma: 0
Senior Member
I tried to add the total of the users online in the logedin section of the homepage without success.

I'd like something like:
"There are 153 users online, of wich 81 are registered members, 21 are invisible and 51 are guests."

Where I've got to make the sum? I'm not very familiar with the template system you used, so I tried adding a variable containing the sum in logedin.inc.t (after modifing the msg entry) with no result.

Thanx


~
~
:wq
Re: Total users online [message #11994 is a reply to message #11993] Thu, 24 July 2003 18:54 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You need to store the sum of the guests, members & invisible inside a variable.

The modify the msg file of the translation you are using (status_line:) to display the sum.


FUDforum Core Developer
Re: Total users online [message #11997 is a reply to message #11994] Thu, 24 July 2003 19:03 Go to previous messageGo to next message
ctbk is currently offline  ctbk   Italy
Messages: 142
Registered: April 2002
Location: Milan, Italy
Karma: 0
Senior Member
I did those things, without result!

I added the following line in logedin.inc.t:

$obj->online_users_tot = $obj->online_users_anon + $obj->online_users_hidden + $obj->online_users_reg;

in logedin.inc.t

and then changed the status_line entry, putting a
<!-- tot:{VAR: $obj->online_users_tot} -->
in the text. Result:

<!-- tot: -->



~
~
:wq
Re: Total users online [message #11999 is a reply to message #11997] Thu, 24 July 2003 19:06 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
{VAR: } will automatically add a $, so you don't need to write it yourself.

FUDforum Core Developer
Re: Total users online [message #12002 is a reply to message #11999] Thu, 24 July 2003 19:22 Go to previous messageGo to next message
ctbk is currently offline  ctbk   Italy
Messages: 142
Registered: April 2002
Location: Milan, Italy
Karma: 0
Senior Member
Embarassed

Anyway, removed the $, rebuilt the theme, cleared the cache, nothing changed: <!-- tot: -->


~
~
:wq
Re: Total users online [message #12005 is a reply to message #12002] Thu, 24 July 2003 19:25 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Are you sure you've put the $obj->online_users_tot = ... inside the display code and not inside the cache code?
You can open the compiled file, logedin.inc and take a look in there to make sure everything is in the right place.
Judging from the output you're getting the variable is either empty or is not avaliable.


FUDforum Core Developer
Re: Total users online [message #12006 is a reply to message #12005] Thu, 24 July 2003 19:35 Go to previous messageGo to next message
ctbk is currently offline  ctbk   Italy
Messages: 142
Registered: April 2002
Location: Milan, Italy
Karma: 0
Senior Member
I checked the logedin.inc and the code is in the right place.

here's a piece of logedin.inc:

        $obj->online_users_anon = q_singleval('SELECT count(*) FROM fud2_ses s WHERE time_sec>'.$tm_expire.' AND user_id>2000000000');
        $obj->online_users_hidden = q_singleval('SELECT count(*) FROM fud2_ses s INNER JOIN fud2_users u ON u.id=s.user_id WHERE s.time_sec>'.$tm_expire.' AND u.invisibl
        $obj->online_users_reg = q_singleval('SELECT count(*) FROM fud2_ses s INNER JOIN fud2_users u ON u.id=s.user_id WHERE s.time_sec>'.$tm_expire.' AND u.invisible_m
    $obj->online_users_tot = $obj->online_users_anon + $obj->online_users_hidden + $obj->online_users_reg;



And this is the status_line in msg:

status_line:                    <!-- totale: {VAR: obj->online_users_tot} -->Ci sono <b>{VAR: st_obj->online_users_reg}</b> utenti, <b> [...]


(it's the italian translation)


~
~
:wq
Re: Total users online [message #12009 is a reply to message #12006] Thu, 24 July 2003 19:44 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Actually that's the wrong place, that's where the cache is made.

You should've added your code right below the
if ($FORUM_INFO == 'Y') {

line


FUDforum Core Developer
Re: Total users online [message #12012 is a reply to message #12009] Thu, 24 July 2003 20:04 Go to previous messageGo to next message
ctbk is currently offline  ctbk   Italy
Messages: 142
Registered: April 2002
Location: Milan, Italy
Karma: 0
Senior Member
Nothing to do... I'm beginning to think it's not so important... Crying or Very Sad

~
~
:wq
Re: Total users online [message #12014 is a reply to message #12012] Thu, 24 July 2003 20:18 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Didn't work?

FUDforum Core Developer
Re: Total users online [message #12031 is a reply to message #11993] Fri, 25 July 2003 07:02 Go to previous messageGo to next message
ctbk is currently offline  ctbk   Italy
Messages: 142
Registered: April 2002
Location: Milan, Italy
Karma: 0
Senior Member
Nope...

~
~
:wq
Re: Total users online [message #12034 is a reply to message #12031] Fri, 25 July 2003 12:48 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Ok, I'll take a closer look at the code.

FUDforum Core Developer
Re: Total users online [message #12097 is a reply to message #12034] Mon, 28 July 2003 17:08 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Here is a patch that after it is applied makes the forum display the total logged in users in () brackets.
Index: src/logedin.inc.t
===================================================================
RCS file: /forum21/install/forum_data/src/logedin.inc.t,v
retrieving revision 1.19
diff -u -r1.19 logedin.inc.t
--- src/logedin.inc.t   14 May 2003 06:14:08 -0000      1.19
+++ src/logedin.inc.t   28 Jul 2003 17:27:49 -0000
@@ -64,6 +64,7 @@
                } else {
                        $logedin = '';
                }
+               $ttl_users = $st_obj->online_users_reg + $st_obj->online_users_hidden + $st_obj->online_users_anon;
                $logedin = '{TEMPLATE: logedin}';
        }
        if ($FORUM_INFO == 'Y') {
Index: thm/default/i18n/english/msg
===================================================================
RCS file: /forum21/install/forum_data/thm/default/i18n/english/msg,v
retrieving revision 1.76
diff -u -r1.76 msg
--- thm/default/i18n/english/msg        24 Jul 2003 22:47:38 -0000      1.76
+++ thm/default/i18n/english/msg        28 Jul 2003 17:27:49 -0000
@@ -141,7 +141,7 @@
 size:                          Size:
 started_on:                    Started On
 status:                                Status:
-status_line:                   There are <b>{VAR: st_obj->online_users_reg}</b> members(s), <b>{VAR: st_obj->online_users_hidden}</b> invisible members and <b>{VAR: st_obj->online_users_anon}</b> guest(s) visiting this board.
+status_line:                   There are ({VAR: ttl_users}) <b>{VAR: st_obj->online_users_reg}</b> members(s), <b>{VAR: st_obj->online_users_hidden}</b> invisible members and <b>{VAR: st_obj->online_users_anon}</b> guest(s) visiting this board.
 sticky:                                sticky:
 stop_ignoring:                 stop ignoring this user
 sub_to_thread:                 Subscribe to topic



FUDforum Core Developer
Re: Total users online [message #26785 is a reply to message #11993] Thu, 11 August 2005 18:57 Go to previous messageGo to next message
severinka is currently offline  severinka   United States
Messages: 3
Registered: August 2005
Karma: 0
Junior Member
Hi, does anyone have code that allows me to put something like,

"Most ever users online was xxxxx on May 10th 2005, at 3 PM"

I need to be able to track the most ever users online at my forum at once. Is it possible to do that? Any help is much appreciated.

Thanks,

Severin
Re: Total users online [message #26790 is a reply to message #26785] Fri, 12 August 2005 15:00 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
This feature was added in CVS and will be available in the next release.

FUDforum Core Developer
Re: Total users online [message #26796 is a reply to message #11993] Fri, 12 August 2005 18:50 Go to previous messageGo to next message
severinka is currently offline  severinka   United States
Messages: 3
Registered: August 2005
Karma: 0
Junior Member
Hi Ilia,

That sounds fantastic. But I guess my next question would be, when is the next version coming out?

Thanks for your time!

Severin
Re: Total users online [message #26798 is a reply to message #26796] Fri, 12 August 2005 19:41 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Well, I expect to release RC1 within a week, the final release will depend on how release candidate holds up.

FUDforum Core Developer
Re: Total users online [message #26799 is a reply to message #11993] Sat, 13 August 2005 17:05 Go to previous message
severinka is currently offline  severinka   United States
Messages: 3
Registered: August 2005
Karma: 0
Junior Member
That sounds great, thanks for all your hard work Smile

Severin
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: CSS patch
Next Topic: Make Fudforum enforce good passwords using cracklib
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 21:04:09 GMT 2024

Total time taken to generate the page: 0.02831 seconds