Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

currently online visitors counter?


Go to End


4 Posts   1729 Views

Avatar
Kalileo

Community Member, 127 Posts

8 February 2010 at 7:48am

Have searched up and down, but there seems to be no built in way to show the count of "currently online unique visitors". (NOT a hitcounter!)

Before I reinvent the wheel, is there a silverstripe solution available already?

Not that I like such counters, but it is a customer requirement ...

Avatar
Willr

Forum Moderator, 5523 Posts

8 February 2010 at 9:06am

The forum has such a feature (as you can see in the footer. How this works is not 'online' as such but people who have logged in in the last 15min. If you're logged in it updates the LastVisited time on every page visit so you can do something like.

function CurrentlyOnline() {
	return DataObject::get('Member','LastVisited > NOW() - INTERVAL 15 MINUTE');
}

Avatar
Kalileo

Community Member, 127 Posts

8 February 2010 at 9:20am

Thanks, Will, yes for logged in visitors this is an easy solution.

I assume I have to create a table to keep track of the IPs of all visitors (not forum, not logged in), that'll give me something similar, and to avoid that table getting too big to delete old entries from time to time.

Avatar
Willr

Forum Moderator, 5523 Posts

8 February 2010 at 9:55am

Yes you would have to keep a separate system for managing IP visitors. Deleting old entries from that table after like 3 days would be smart as well.