1.20.x user.install user_update_1014()

Fixes system email linebreaks.

Related topics

File

modules/user/user.install, line 1162
Install, update and uninstall functions for the user module.

Code

function user_update_1014() {
  $emails = array(
    'register_admin_created_body',
    'register_pending_approval_body',
    'register_no_approval_required_body',
    'register_no_approval_required_body',
    'password_reset_body',
    'status_activated_body',
    'status_blocked_body',
    'cancel_confirm_body',
    'status_canceled_body',
  );
  $config = config('user.mail');
  foreach ($emails as $name) {
    $mail = $config->get($name);
    if (strstr($mail, '\n')) {
      $fixed_mail = str_replace('\n', "\n", $mail);
      $config->set($name, $fixed_mail);
    }
  }
  $config->save();
}