I have a form where a logged in user can have a confirmation email sent to them. I’m showing an email input field with the email address from their profile prefilled. However, if they change it, I’d like to update their user profile mail address as well.
I have tried:
if ($form->data['email'] != $user['email']) {
$user->email = $form->data['email'];
}
This does change the email address, but I think it doesn’t write it to the user’s yaml file, because after logging out and back in again, the old one is back. So how can I permanently save that?