1

I need to take control over and change the flash notification a user gets when they register, but administrator approval is required.

I want to alter this...
"Thank you for applying for an account. Your account is currently pending approval by the site administrator. In the meantime, a welcome message with further instructions has been sent to your email address"

https://api.drupal.org/api/drupal/core%21modules%21user%21src%21RegisterForm.php/function/RegisterForm%3A%3Asave/8.2.x

It states...
'Normally this method should be overridden to provide specific messages to the user and redirect the form after the entity has been saved.'

  1. I'm trying to figure out what the Drupal 8 way of doing this is.

  2. Should I be trying to "alter" the message with a hook?

  3. Should I be overriding a service? (though from my understanding this is not service).

  4. Should I be extending this?

  5. Or is there some other best practice way of overriding this?

I'm learning Drupal 8. So I'm not entirely sure the "right" way to handle this particular case.

2 Answers 2

1

Brandon's answer is good for altering the email messages.

If you are looking to alter the status message that pops up afterwards, I found this answer helpful: https://stackoverflow.com/a/38797543/963866

0

Email notification settings (not status messages) are configuration. Visit yourdrupalsite.com/admin/config/people/accounts

This also lives in the configuration object user.mail. If you export your site configuration you can see its value in user.mail.yml.

Drush cli tool can get this configuration entity with the following command drush cget user.mail

1
  • Thanks Brandon, but yeah, I was wanting to change the Drupal status message not the email text.
    – xpersonas
    Commented Apr 16, 2018 at 13:54

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