Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Active vs. Registered users

Quote Reply
Active vs. Registered users
Hi!

Is it possible to identify active users (posted/logged in/replied/etc. in the last X days)?

For example, a forum states that it has XXXXXX registered users on the top right of the main forum page. Could a XXXX Active Users tag be added below that?

I know this is getting close to a "Who's Online" box as well (which may be a nice compliment to the Active Users tag.Cool



Just a thought!
Quote Reply
Re: [Teambldr] Active vs. Registered users In reply to
You could use global variables for this.

For example, to display users who have logged in in the last 7 days, you would use:

sub { $DB->table('User')->count(GT::SQL::Condition->new(user_last_logon => '>=' => time - 7 * 24 * 60 * 60)) }

For number of users who have posted:

sub { $DB->table('User')->count(GT::SQL::Condition->new(user_posts => '>=' => 1)) }

You could combine the two to display users who have posted in the last 7 days, but it gets a little more hairy (Note: the following probably does not work with older (3.22.x or before) releases of MySQL):

sub { $DB->table('Post')->select('COUNT(DISTINCT(user_id_fk))' => GT::SQL::Condition->new(post_time => '>=' => time - 7 * 24 * 60 * 60))->fetchrow }

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Active vs. Registered users In reply to
Thanks Jagman!