Home: Products: Plugins: GForum Plugins: Mods: Most Users Ever

This is a fix to the Who's On-line which eliminates duplicate IP's, as well as keeping track of the highest number of Users and Guests and the date/time that it happened.
Please note, this plugin is also part of the following "packages";

Other Details


Plugin Description

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.

Download the Online.pm file here, and upload it to your ../admin/Plugins directory -- Download



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 
--------------------------------------------------------------------------------
 


The highest number of users on this system was  on 
The highest number of guests on this system was  on  


--------------------------------------------------------------------------------
 

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. 

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 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.