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.

1 Answer 1


Use the function getOrigData to check it :

Example :

$customerData = $observer->getEvent()->getData('customer');
$newData = $customerData->getData('test');
$previousData = $customerData->getOrigData('test');

And then you can compare :

$previousData == $newData ? echo 'same' : echo 'different';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.