You are here

function logintoboggan_resend_validation in LoginToboggan 5

Same name and namespace in other branches
  1. 6 logintoboggan.module \logintoboggan_resend_validation()
  2. 7 logintoboggan.validation.inc \logintoboggan_resend_validation()

Re-sends validation e-mail to user specified by $uid.

1 string reference to 'logintoboggan_resend_validation'
logintoboggan_menu in ./logintoboggan.module
Implementation of hook_menu()

File

./logintoboggan.module, line 1021
Logintoboggan Module

Code

function logintoboggan_resend_validation($uid) {
  global $base_url;
  $account = user_load(array(
    'uid' => $uid,
  ));

  // Variables to replace in e-mail
  $pass = t('If required, you may reset your password from: !url', array(
    '!url' => url('user/password', NULL, NULL, TRUE),
  ));
  $variables = array(
    '!username' => $account->name,
    '!site' => variable_get('site_name', 'drupal'),
    '!password' => $pass,
    '!uri' => $base_url,
    '!uri_brief' => substr($base_url, strlen(_logintoboggan_protocol() . '://')),
    '!mailto' => $account->mail,
    '!date' => format_date(time()),
    '!login_uri' => url('user', NULL, NULL, TRUE),
    '!edit_uri' => url('user/' . $account->uid . '/edit', NULL, NULL, TRUE),
    '!login_url' => logintoboggan_eml_validate_url($account),
  );

  // Prepare and send e-mail.
  $from = variable_get('site_mail', ini_get('sendmail_from'));
  $subject = _user_mail_text('welcome_subject', $variables);
  $body = _user_mail_text('welcome_body', $variables);
  drupal_mail('logintoboggan-resend-validation', $account->mail, $subject, $body, $from);

  // Notify admin or user that e-mail was sent and return to user edit form.
  if (user_access('administer users')) {
    drupal_set_message(t("A validation e-mail has been sent to the user's e-mail address."));
  }
  else {
    drupal_set_message(t('A validation e-mail has been sent to your e-mail address. You will need to follow the instructions in that message in order to gain full access to the site.'));
  }
  drupal_goto('user/' . $account->uid . '/edit');
}