I created a new tab on User edit, with a form

I want to save the data getting from the form the other table on Database (Ex: test_table) when I click on save user button, is there any method to do that?

Button of user back-office Magento 2

I try to use events


<event name="customer_account_edited">
    <observer name="test_event" instance="Testing\Test\Observer\TestUserOnSave"/>

PHP (TestUserOnSave)

public function execute(Observer $observer){
   $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/logger.log');
   $logger = new \Zend\Log\Logger();
   $logger->info('test events');

But it's doesn't work, is there any solution?


You need to create module with observer that will load for example on

' admin_user_save_after` event

In observer you can insert Your function.

List of events: https://www.mageplaza.com/magento-2-module-development/magento-2-events.html

  • Thanks for your reply sir, but I don't find admin_user_save_after events (for admin-user, not the customer) – sayou May 10 '19 at 9:55
  • Oh sorry I edited answer – BartZalas May 10 '19 at 9:59
  • I try it, but it's doesn't work, I think this events customer_account_edited it's just for customers and not for admin users, you can check my new edit on the post – sayou May 10 '19 at 10:15
  • 1
    what about admin_user_save_after – BartZalas May 10 '19 at 10:39

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.