Hey Magento Folks?,

How have you been? Embrace yourself at How-To Magento 2 Series. Today I will cover Magento 2 : How to get admin user data in the observer? with codes of it. Make sure you go through our previously published blog How to Change the Default Product Image Size in Magento 2. Let’s dive in?.

Introduction:

Generally, Magento offers creating events and observers. It is one type of Magento class where the created observer helps in identifying the performance, general behavior and to improve your business logic. Mainly, the observers are initiated whenever the events are created and implemented by the event manager. Here, I will help you to get admin user data in the observer.

Steps to get admin user data in observer:

Firstly, you need to create a separate extension or just inject the file in some other extension. both will work to get admin user data in the observer.

Step 1: Create event.xml in your extension at the below-given path:

Path: app\code\Vendor\Extension\etc\event.xml

Step 2: After this, you need to create an observer file at the below path.

Path: app\code\Vendor\Extension\Observer\Backenduserobserver.php

That’s it this will provide you all the data while any user is login into the backend.

Final Words:

With assurance, the above solution will help you to get admin user data in observer in case any casualties do comment down your queries in the comment section below. Also, share the article to help your Magento developer friends via social media share. Till then Stay Safe Stay Healthy.

Happy Coding?

Click to rate this post!
[Total: 2 Average: 5]