function user_email_verification_reminder in User email verification 7
Queue worker callback for sending a single reminder.
Parameters
int $uid: The user ID to process.
1 string reference to 'user_email_verification_reminder'
File
- ./
user_email_verification.module, line 72 - 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_reminder($uid) {
// Only send the reminder if the user is not verified yet and the number of
// reminders has not been reached yet.
$interval = variable_get('user_email_verification_validate_interval', 86400);
$num_reminders = variable_get('user_email_verification_num_reminders', 0);
$reminder_interval = $interval / ($num_reminders + 1);
$result = db_query("SELECT reminders FROM {user_email_verification} WHERE uid = :uid\n AND verified = 0 AND reminders < :num_reminders AND last_reminder < :reminder", array(
':uid' => $uid,
':num_reminders' => $num_reminders,
':reminder' => REQUEST_TIME - $reminder_interval,
))
->fetchField();
if ($result === FALSE) {
return;
}
$account = user_load($uid);
$params['account'] = $account;
$language = user_preferred_language($account);
drupal_mail('user_email_verification', 'verify', $account->mail, $language, $params);
if (module_exists('rules')) {
// Invoke rules event
rules_invoke_event('user_email_verification_account_reminded', $account);
}
// Always increase the reminder mail counter by one even if sending the mail
// failed. Some mail systems like Mandrill return FALSE if they cannot deliver
// the mail to an invalid address. We need to increase the counter to make
// sure the users get blocked at some point.
db_update('user_email_verification')
->condition('uid', $account->uid)
->expression('reminders', 'reminders + 1')
->fields(array(
'last_reminder' => REQUEST_TIME,
))
->execute();
}