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.

Customising the CMS /

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

Relation between member and guest(visitor)


Go to End


10 Posts   2579 Views

Avatar
wmk

Community Member, 87 Posts

16 April 2015 at 1:01am

Hi Jonny9,

why not creating another dataobject for logging? This way you cannot only log WHO is visiting you, also when and how often.

Member:
$has_many = ['VisitorLogs', 'VisitorLog']

class VisitorLog extends DataObject {
    private static $db = [
        'Guest' => 'Member', //the visitor, see Member::currentUserID() to get the current user
        'Visited' => 'Member', //the member who got visited,
    // ... timestamp and whatever you want to add
    ]

}

untested though...

Avatar
Johnny9

Community Member, 35 Posts

16 April 2015 at 2:55am

Hi, I was thinking about this method also, just to store two member ids and thats it. Just wanted to know maybe where is a better way to do it in SS:) thanks for help.

Go to Top