You are here

function user_expire_mail in User Expire 7

Same name and namespace in other branches
  1. 8 user_expire.module \user_expire_mail()

Implements hook_mail().

File

./user_expire.module, line 469
Main module file for User expire module.

Code

function user_expire_mail($key, &$message, $params) {
  if ($key == 'expiration_warning') {

    // The subject.
    $message['subject'] = t('@site_name: Account expiration warning', array(
      '@site_name' => variable_get('site_name', 'Drupal.org'),
    ));

    // The body.
    $message['body'][] = t('Hello @user', array(
      '@user' => format_username($params['account']),
    ));

    // An empty string gives a newline.
    $message['body'][] = '';
    $message['body'][] = t('Because you have not logged in recently, your account at @site_name will be blocked in the near future. If you still use this site, please log in @login_url to avoid having your account blocked.', array(
      '@site_name' => variable_get('site_name', 'Drupal.org'),
      '@login_url' => url('user', array(
        'absolute' => TRUE,
      )),
    ));
    $message['body'][] = '';
    $message['body'][] = t('Thanks, @site_name', array(
      '@site_name' => variable_get('site_name', 'Drupal.org'),
    ));
  }
  else {
    if ($key == 'account_expired') {

      // The subject.
      $message['subject'] = t('@site_name: Account expired', array(
        '@site_name' => variable_get('site_name', 'Drupal.org'),
      ));

      // The body.
      $message['body'][] = t('Hello @user', array(
        '@user' => format_username($params['account']),
      ));

      // An empty string gives a newline.
      $message['body'][] = '';
      $message['body'][] = t('We have written this email to inform you that your account at @site_name is blocked.', array(
        '@site_name' => variable_get('site_name', 'Drupal.org'),
      ));
      $message['body'][] = '';
      $message['body'][] = t('Thanks, @site_name', array(
        '@site_name' => variable_get('site_name', 'Drupal.org'),
      ));
    }
  }
}