I'm trying to change the default behaviour of member+group system, so that when member gets added to some specific group in backend (Security tab), he receives mail about it.
So if I'm right, the proper way to do this is through DataObjectDecorator and onBeforeWrite. Inside onBeforeWrite function I'm failing to get the old state of member groups, so I could compare which groups are new. Also something like $member->isChanged('Groups') is always false and I think it has something to do with many-many relation between member and group. Also putting die before parent::onBeforeWrite() shows me that new member groups have already been saved before onBeforeWrite have been excecuted, and normally "die" should preserve old state which it does on other fields, but not groups.
Similar question have already been asked here http://www.silverstripe.org/dataobjectmanager-module-forum/show/10548 but no solution found :( Does anyone know how I could get the old state inside onBeforeWrite or another way to accomplish this task?