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.

General Questions

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

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

Detect if DataObject has changed


Reply

3 Posts   764 Views

Avatar
Mo

14 September 2012 at 8:42pm Community Member, 509 Posts

Hi All,

I am trying to write an Akismet module for comments (SS3). Repo can be found here:

https://github.com/i-lateral/silverstipe-akismet

Using a lot of butchered 2.4 code at the mo, but managed to get it reporting a spam post by extending a comment's onBeforeWrite().

I need to get the report spam and report ham functionality working though, but I am not sure if I can detect if the Comment object has changed from within onBeforeWrite()?

Any ideas? Would love to get this released.

Cheers,

Mo

Avatar
simon_w

14 September 2012 at 10:12pm Forum Moderator, 474 Posts

$this->owner->isChanged(), or $this->owner->isChanged('FieldName');

Avatar
Mo

14 September 2012 at 10:40pm Community Member, 509 Posts

Oooo, cool!

Cheers Simon, I will get on and fiddle with this as soon as!

:-)