Admin User create event
-
16-10-2019 - |
Question
I am working on a new project. I am facing a problem where I need to save the details when an admin user is created. I am planning to use an observer to catch the event. I need to know that is there any event in magento defined for getting the admin user creation.
Thanks in advance.
Solution
Try to use admin_user_save_after
.
In your observer you can then retrieve the user like this:
public function doSomething($observer){
$adminUser = $observer->getEvent()->getObject();
//do something with admin user
}
Keep in mind that this event is dispatched even when an existing user changes his password.
To identify if the user is new, you can check :
$adminUser->getOrigData('user_id');
If the code above returns null
then is a new admin.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange