You are here

function user_email_verification_mail_alter in User email verification 7

Implements hook_mail_alter().

File

./user_email_verification.module, line 410
This module allows you to have e-mail verification and in meanwhile allowing the users to type their own passwords. If they do not verify their accounts in a certain time interval the user will be blocked.

Code

function user_email_verification_mail_alter(&$message) {
  if ($message['module'] == 'user' || $message['module'] == 'user_email_verification') {
    $language = $message['language'];
    $params = $message['params'];
    $account = $params['account'];
    if (!empty($account)) {
      if (!empty($message['subject'])) {
        $message['subject'] = token_replace($message['subject'], array(
          'user' => $account,
        ), array(
          'language' => $language,
          'sanitize' => FALSE,
          'clear' => TRUE,
        ));
      }
      if (!empty($message['body'])) {
        foreach ($message['body'] as &$body) {
          $body = token_replace($body, array(
            'user' => $account,
          ), array(
            'language' => $language,
            'sanitize' => FALSE,
            'clear' => TRUE,
          ));
        }
      }
    }
  }
}