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.

Customising the CMS /

Versioning the Member object


Reply


3 Posts   298 Views

Avatar
MonkeyBen

Community Member, 25 Posts

21 February 2012 at 11:58pm

I have a SilverStripe website where I would like to keep track of changes to a members profile. If I add the Versioned extension to the Member class (well the CustomMember class) will that cause any problems to the the Members functions, e.g. login in, or viewing the admin section?

Avatar
swaiba

Forum Moderator, 1799 Posts

22 February 2012 at 1:07am

I have no idea what side effects applying versioned to Member might cause.

As an alternative I'd add an onAfterWrite instead that save the changes...

public function onAfterWrite() {
   parent::onAfterWrite();

   $arrChanged = $this->getChangedFields(true,1);

   if (count($arrChanged)) {
      //create a MemberHistory log here?
   }
}

Avatar
MonkeyBen

Community Member, 25 Posts

22 February 2012 at 2:57am

That's the method the website is using at the moment, I'm just wondering if versioning would be cleaner and give an option of rolling back changes.