How to adding senders name to order comments in the magento2 admin panel. I don't know how to implement this task. Can you please help me? The below screenshot is my required output screenshot.https://prnt.sc/jtx9di
How to Add Sender’s Name to Order Comments in Magento2 Admin
adminmagento2.2
Best Answer
You need to override the following file:
After that inject \Magento\Backend\Model\Auth\Session like below:
Under execute function add the below line:
In place of
All done. After that you can edit anything from admin will show the admin username to the comments.
If you want to edit the core file AddComment.php then you can add the following code to your AddComment.php. But this is not a good practice to modify core files directly. Best way is to override that file and work accordingly. Code for AddComment.php:
After the changes run the below commands:
(if needed)(-f if developer mode and default mode enabled)
Hope this helps!