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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Logging Logged in User's IP Addresses

Go to End

3 Posts   1400 Views


Community Member, 89 Posts

6 August 2010 at 8:49pm

I have a SilverStripe site where users have to pay a subscription fee in order to be able to view the site content.

I would like to log user's IP addresses when they access the site, so that in future I can detect if a user is logging in for different IP addresses at the same time, which would be an indication this user has given their login details to another party.

What is the best way to go about doing this? I presume I have 2 choices, log IP upon login or upon visiting, I believe "LastVisited" updates every time a user changes pages, so would that add too much overhead if I was logging their IP each time too?

Either way, how can I perform an action upon "login" and upon "visited"?



Forum Moderator, 1899 Posts

8 August 2010 at 6:32am

hmmm I'd be very interested what you end up with... my suggestions would be....

1) to decorate/use custom class the Member (I can't remember which I've used at the moment) then use an onAfterWrite and note when 'LastVisited' changed (

2) to add something like this to
<% if CurrentMember %>$MyMemberIPLoggerFunction<% end_if %>

Hope this helps,



Community Member, 89 Posts

9 August 2010 at 9:42pm

Thanks swaiba. That sounds I good place to start. I'll let you know how I get on.