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.

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

Detect if DataObject has changed


Go to End


3 Posts   3494 Views

Avatar
Mo

Community Member, 541 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
(deleted)

Community Member, 473 Posts

14 September 2012 at 10:12pm

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

Avatar
Mo

Community Member, 541 Posts

14 September 2012 at 10:40pm

Oooo, cool!

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

:-)