function signup_validate_anon_email in Signup 5.2
Same name and namespace in other branches
- 5 signup.module \signup_validate_anon_email()
- 6.2 includes/signup_form.inc \signup_validate_anon_email()
- 6 includes/signup_form.inc \signup_validate_anon_email()
- 7 includes/signup_form.inc \signup_validate_anon_email()
Validates an anonymous signup email.
Parameters
$nid The node the user is signing up for.:
$anon_mail The anonymous email address to validate.:
$name Optional. The form element being validated.:
Return value
Boolean. TRUE if the address validates, FALSE otherwise.
1 call to signup_validate_anon_email()
- signup_form_validate_anon in ./
signup.module - Validates the email address on the anonymous user signup form.
File
- ./
signup.module, line 2279 - The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…
Code
function signup_validate_anon_email($nid, $anon_mail, $name = FALSE) {
if (!valid_email_address($anon_mail)) {
$message = t('Invalid email address entered for signup.');
}
elseif (db_num_rows(db_query("SELECT mail FROM {users} WHERE mail = '%s'", $anon_mail))) {
$message = t('The email address entered belongs to a registered user.');
}
elseif (db_num_rows(db_query("SELECT anon_mail FROM {signup_log} WHERE anon_mail = '%s' AND nid = %d", $anon_mail, $nid))) {
$node = node_load($nid);
$message = t('The email address entered has already been used to sign up for this %node_type.', array(
'%node_type' => node_get_types('name', $node->type),
));
}
// If there's no message, it's a valid email, so return success.
if (!isset($message)) {
return TRUE;
}
// Depending on how we were called, propagate the error accordinly.
if ($name) {
form_set_error($name, $message);
}
else {
drupal_set_message($message, 'error');
}
return FALSE;
}