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   881 Views

Avatar
Mo

Community Member, 514 Posts

14 September 2012 at 8:42pm

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

Forum Moderator, 474 Posts

14 September 2012 at 10:12pm

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

Avatar
Mo

Community Member, 514 Posts

14 September 2012 at 10:40pm

Oooo, cool!

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

:-)