function simplenews_confirm_subscription in Simplenews 5
Same name and namespace in other branches
- 6.2 includes/simplenews.subscription.inc \simplenews_confirm_subscription()
- 6 simplenews.subscription.inc \simplenews_confirm_subscription()
- 7.2 includes/simplenews.subscription.inc \simplenews_confirm_subscription()
- 7 includes/simplenews.subscription.inc \simplenews_confirm_subscription()
Menu callback; confirm the user's (un)subscription request when they click on the confirm link in the e-mail footer.
1 string reference to 'simplenews_confirm_subscription'
- simplenews_menu in ./
simplenews.module - Implementation of hook_menu().
File
- ./
simplenews.module, line 2610
Code
function simplenews_confirm_subscription($op1 = NULL, $op2 = NULL) {
$md5 = drupal_substr($op2, 0, 10);
list($snid, $tid) = explode('t', drupal_substr($op2, 10));
$result = db_query('SELECT snid, mail FROM {simplenews_subscriptions} WHERE snid = %d', $snid);
if (!($subs = db_fetch_object($result))) {
drupal_not_found();
return;
}
if ($md5 == drupal_substr(md5($subs->mail . simplenews_private_key()), 0, 10)) {
$newsletter = taxonomy_get_term($tid);
if ($op1 == 'remove') {
return drupal_get_form('simplenews_confirm_removal_form', $subs->mail, $newsletter);
}
elseif ($op1 == 'add') {
return drupal_get_form('simplenews_confirm_add_form', $subs->mail, $newsletter);
}
}
// If md5 didn't match, do a not found.
drupal_not_found();
return;
}