0

If users update their email address, an email should be sent to the old and new email addresses to confirm the transaction.

How can I achieve this in Drupal 8?

1 Answer 1

0

You could add a HOOK_user_presave method in your custom module.

Example:

function mymodule_user_presave(\Drupal\user\UserInterface $user) {
    if ( !($user->isNew()) ) {
        //check if the value in the db is different to the value in $user
        if ($user->original->getEmail() == $user->getEmail()) {
            // send email
        }
    }
}

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.