function logintoboggan_mail in LoginToboggan 6
Implementation of hook_mail().
File
- ./
logintoboggan.module, line 1280 - Logintoboggan Module
Code
function logintoboggan_mail($key, &$message, $params) {
global $base_url;
$language = $message['language'];
$langcode = isset($language) ? $language->language : NULL;
$variables = user_mail_tokens($params['account'], $language);
// Customize special tokens.
$variables['!uri_brief'] = substr($base_url, strlen(_logintoboggan_protocol() . '://'));
if (isset($params['login_url'])) {
$variables['!login_url'] = $params['login_url'];
}
switch ($key) {
case 'register_pending_approval_admin':
$variables['!validating_url'] = $params['validating_url'];
$message['subject'] .= t("(!site) Account application for !username", $variables, $langcode);
$reg_pass_set = !variable_get('user_email_verification', TRUE);
if ($reg_pass_set) {
$message['body'][] = t("!username has applied for an account, and has automatically received the permissions of the LoginToboggan validating role. To give the user full site permissions, click the link below:\n\n!validating_url\n\nAlternatively, you may visit their user account listed below and remove them from the validating role.\n\n!edit_uri", $variables, $langcode);
}
else {
$message['body'][] = t("!username has applied for an account.\n\n!edit_uri", $variables, $langcode);
}
break;
case 'logintoboggan_resend_validation':
$message['subject'] .= strtr(variable_get('user_mail_register_no_approval_required_subject', _user_mail_text('register_no_approval_required_subject')), $variables);
$message['body'][] = strtr(variable_get('user_mail_register_no_approval_required_body', _user_mail_text('register_no_approval_required_body')), $variables);
break;
default:
$message['subject'] .= strtr(variable_get('user_mail_' . $key . '_subject', _user_mail_text($key . '_subject')), $variables);
$message['body'][] = strtr(variable_get('user_mail_' . $key . '_body', _user_mail_text($key . '_body')), $variables);
}
}