2

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

XML:

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

PHP (TestUserOnSave)

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

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

1 Answer 1

1

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

4
  • Thanks for your reply sir, but I don't find admin_user_save_after events (for admin-user, not the customer)
    – sayou
    Commented May 10, 2019 at 9:55
  • Oh sorry I edited answer
    – BartZalas
    Commented May 10, 2019 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
    Commented May 10, 2019 at 10:15
  • 1
    what about admin_user_save_after
    – BartZalas
    Commented May 10, 2019 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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