0

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.

0

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, privacy policy and cookie policy

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