Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [carfac] Most Users Ever

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
Subject Author Views Date
Thread Most Users Ever carfac 5934 Nov 8, 2003, 12:58 PM
Thread Re: [carfac] Most Users Ever
hoefti 5727 Nov 12, 2003, 11:44 PM
Thread Re: [hoefti] Most Users Ever
carfac 5730 Nov 13, 2003, 7:49 AM
Thread Re: [carfac] Most Users Ever
Jagerman 5693 Nov 17, 2003, 4:49 PM
Thread Re: [Jagerman] Most Users Ever
pugdog 5629 Dec 2, 2003, 2:18 PM
Thread Re: [pugdog] Most Users Ever
pugdog 5605 Dec 3, 2003, 12:48 AM
Thread Re: [pugdog] Most Users Ever
pugdog 5592 Dec 4, 2003, 7:56 AM
Thread Re: [pugdog] Most Users Ever
carfac 5548 Dec 8, 2003, 8:05 PM
Post Re: [carfac] Most Users Ever
pugdog 5560 Dec 9, 2003, 4:24 AM