I have created user Approve module which lets admin to approve user after registration.
I want to send a email on activation and deactivation of a user, How can I find that the admin has changed the status during save.
Use the function
getOrigData to check it :
$customerData = $observer->getEvent()->getData('customer'); $newData = $customerData->getData('test'); $previousData = $customerData->getOrigData('test');
And then you can compare :
$previousData == $newData ? echo 'same' : echo 'different';