Jump to content

Recommended Posts

Posted

Hi,

I'd like to add a checkbox ("Notify users about changes") to the user profile editor and, after user has saved his profile and checked this box, send some e-mail notifications about his changes. I'm using a mechanism like that successfully for other pages by using hooks on ProcessPageEdit::buildFormContent and Pages::saved, this also works when editing any "user" page as admin, but it doesn't work when editing the user page via the "Profile" menu item. Is there any hook that can achieve that for profile editing? I've tried ProcessProfile::execute, but I couldn't find a way to get the form's raw data from there.

  • 2 months later...
Posted

@FlorianA I know your question is a bit old, but I just recently had to do this and below is how you get the form data. In my case, I put it all in a custom module.

Gets called after an update is made at /admin/profile/

 public function init() {

	$this->pages->addHookAfter('ProcessProfile::execute', $this, 'sendOutProfileNotification');
}

public function sendOutProfileNotification(HookEvent $event) {

	$event = $event->object;

    //form data is found in        
	$data = $event->return;   

    //do something with data here is data is not null.

}

Hope that helps.

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...