Gossamer Forum
Quote Reply
Most Users Ever
Anyone ever code up something to store and return the most users/guests ever online? I have seen this on other forums, and think it is cool.
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Most Users Ever In reply to
Hello i need this function too

hoefti
linktobuy Web Directory
Ratgeber Recht
Quote Reply
Re: [hoefti] Most Users Ever In reply to
Been thinking about this a bit...

It would take a new table with two (possibly 4) fields- most users, most guests... ossibly dated and times...

The comparing the current number of users to the historical high (and writing back the higher) is pretty simple. I just do not see where to get the current number of users number...
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Most Users Ever In reply to
GForum::Online::whos_online does this, however the problem is that that code is run only when someone views the Who's Online page. You might be able to do this through a "main" post-hook - when it's called, update the information (if necessary), then add a global that you call that returns the relevant information. You don't necessarily need to add a table for this - you could store in directly in the config file with something like:

Code:
my $need_save;
if ($current_users > $CFG->{highest_current_users_ever}) {
$CFG->{highest_current_users_ever} = $current_users;
$CFG->{highest_current_users_ever_time} = time;
$need_save++;
}
if ($current_guests > $CFG->{highest_current_guests_ever}) {
$CFG->{highest_current_guests_ever} = $current_guests;
$CFG->{highest_current_guests_ever_time} = time;
$need_save++;
}
$CFG->save if $need_save;


To retrieve it, you'd use a global something like:
Code:
sub {
my ($u, $uwhen, $g, $gwhen) = @$CFG{qw/
highest_current_users_ever
highest_current_users_ever_when
highest_current_guests_ever
highest_current_guests_ever_when
/};

return {
highest_user_count => $u,
highest_users_when => GForum::date($uwhen),
highest_guest_count => $g,
highest_guests_when => GForum::date($gwhen)
}
}

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Most Users Ever In reply to
Which version of GForum does that?

I've looked at several, and none seem to keep the highest stats, and none of my configs have that as one of the stored values.

Version 1.2.0 has a revision date of 2003/02/09 on that module, and ver 1.17.2.1


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Most Users Ever In reply to
I decided to make this work, since I just had an article published, and wanted to see what it did to the traffic to the site mentioned.

Copy the attached Online.pm to your admin/Plugins/Gforum directory. You might need to use
the file manager to do it rather than telnet. It's a copy of the Online.pm from the GForum
directory with a few changes.


And, somewhere on the main category_list.html put the function call:
<%Plugins::GForum::Online::whos_online%>

If you are using the search engine templates, you'll have to make the change to the
search_engine and default (and any other set you use) templates for consistency.

You need to create a global called most_users_ever:

Code:
sub {
my ($u, $uwhen, $g, $gwhen) = @$CFG{qw/
highest_current_users_ever
highest_current_users_ever_time
highest_current_guests_ever
highest_current_guests_ever_time /};
return {
highest_user_count => $u,
highest_users_when => GForum::date($uwhen),
highest_guest_count => $g,
highest_guests_when => GForum::date($gwhen)
} }

And, finally, Add this to the Whos_online.html template, above the footer is a good place.

Code:
<%most_users_ever%>
<%body_font%>
The highest number of users on this system was <%highest_user_count%> on <%highest_users_when%><BR>
The highest number of guests on this system was <%highest_guest_count%> on <%highest_guests_when%><BR>
<%/body_font%>

This is working on my system. I think :)

The guest count isn't accurate, as I see the same IP's listed several times for different
areas. A fix might be to group by IP for the Guests, or select unique count if you want a better count.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Most Users Ever In reply to
I made a small modification to the Online.pm, and the _same_ mod could be made to the GForum::Online.pm as well, if you want a bit more accuracy on the screen.

Code:


my $guests = [];
my $found_IPs;
while (my $rec = $sth->fetchrow_hashref) {
push @$guests, $rec if not exists $found_IPs->{$rec->{online_ip}};
$found_IPs->{$rec->{online_ip}} = "found";
}


basicly, if you've already found the IP (it's in newest-first order via the select), don't add that "guest" again. It's fair to assume that the same IP within 15 minutes (the default value) is going to be the same user refreshing the main page). Might only be the way I have my redirects configured, but I get multiple entries for each IP at times. This blocks this "bug" in how the client/server dance works.

BTW: if you want to increase performance on a moderately active forum system, you can move the <%Plugins::Online::whos_online%> function call to any other page that is accessed less frequently, but regularly than your main page. The search page would be a good alternative, as would the who's on line page, but realize, that the most-ever stats will only get updated if/when someone uses those features, not every time a person visits, so you might miss your "true" peak.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Most Users Ever In reply to
Pugdog:

Thanks for fixing the double-counting of users- that has always bugged me!

I switched to your code, works great on my install!
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Most Users Ever In reply to
<G> thanks. My first Gforum hack.

With the new traffic to my site due to the article, I wanted to see what was really going on. I'm up to 8-9 users, down from the 64 reported before the fix, but that is up from the 2-3 that was before.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.