email_verify.module in Email Verify 7
Same filename and directory in other branches
Verifies thoroughly that email addresses are correctly entered Copyright: Daniel Bonniot <bonniot@users.sourceforge.net> License: GNU GPL v2 or later
File
email_verify.moduleView source
<?php
/**
* @file
* Verifies thoroughly that email addresses are correctly entered
* Copyright: Daniel Bonniot <bonniot@users.sourceforge.net>
* License: GNU GPL v2 or later
*/
/**
* Implements hook_help().
*/
function email_verify_help($path, $arg) {
if ($path == 'admin/help#email_verify') {
$txt = 'This module verifies that email addresses are valid during account registration or edit.';
return '<p>' . t($txt) . '</p>';
}
}
/**
* Implements hook_permission().
*/
function email_verify_permission() {
return array(
'bypass email verification' => array(
'title' => t('Bypass email verification'),
'description' => t('Allow email verification to be bypassed when performing user operations.'),
),
);
}
/**
* Implements hook_menu().
*/
function email_verify_menu() {
$items = array();
$items['admin/people/email_verify'] = array(
'title' => 'Email Verify',
'page callback' => 'email_verify_checkall',
'access callback' => 'email_verify_access_people_email_verify',
'type' => MENU_LOCAL_TASK,
'file' => 'email_verify.check.inc',
);
$items['admin/config/system/email_verify'] = array(
'title' => 'Email Verify',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'email_verify_admin_settings',
),
'access arguments' => array(
'administer site configuration',
),
'description' => "Configure the Email Verify module's administrative settings.",
'file' => 'email_verify.admin.inc',
);
return $items;
}
/**
* Access callback for the page at admin/people/email_verify.
*/
function email_verify_access_people_email_verify() {
if (variable_get('email_verify_active', 0) && user_access('administer users')) {
return TRUE;
}
return FALSE;
}
/**
* Implements hook_form_FORM_ID_alter() for the user_register form.
*/
function email_verify_form_user_register_form_alter(&$form, &$form_state, $form_id) {
if (variable_get('email_verify_active', 0) && variable_get('email_verify_user_registration', 1)) {
$form['#validate'][] = 'email_verify_edit_validate';
}
}
/**
* Implements hook_form_FORM_ID_alter() for the user_profile form.
*/
function email_verify_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
if (variable_get('email_verify_active', 0) && variable_get('email_verify_user_profile', 1)) {
$form['#validate'][] = 'email_verify_edit_validate';
}
}
/**
* Implements hook_form_FORM_ID_alter() for the contact_site form.
*/
function email_verify_form_contact_site_form_alter(&$form, &$form_state, $form_id) {
if (variable_get('email_verify_active', 0) && module_exists('contact') && variable_get('email_verify_site_contact', 0)) {
$form['#validate'][] = 'email_verify_edit_validate';
}
}
/**
* Implements hook_form_FORM_ID_alter() for the contact_personal form.
*/
function email_verify_form_contact_personal_form_alter(&$form, &$form_state, $form_id) {
if (variable_get('email_verify_active', 0) && module_exists('contact') && variable_get('email_verify_personal_contact', 0)) {
$form['#validate'][] = 'email_verify_edit_validate';
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* For the Entity Registration module's Registration Form.
* https://www.drupal.org/project/registration
*/
function email_verify_form_registration_form_alter(&$form, &$form_state, $form_id) {
if (variable_get('email_verify_active', 0) && variable_get('email_verify_user_registration', 1)) {
$form['#validate'][] = 'email_verify_edit_validate';
}
}
/**
* Additional validation for the user form.
*
* @param array $form
* The form definition.
* @param array $form_state
* The form values which you may perform validation on.
*/
function email_verify_edit_validate($form, &$form_state) {
if (!user_access('bypass email verification') && $form_state['values']['op'] != t('Cancel account')) {
// Validate the e-mail address.
if ($error = email_verify_check($form_state['input']['mail'])) {
form_set_error('mail', $error);
}
}
}
/**
* Verifies whether the given mail address exists.
*
* @param string $mail
* Email address to verify.
*
* @return string
* NULL if the address exists, or an error message if we found a problem with
* the address.
*/
function email_verify_check($mail) {
module_load_include('php', 'email_verify', 'email_verify.inc');
return _email_verify_check($mail);
}
/**
* Determine if Email Verify is enabled.
*
* @return boolean
* Indicates whether the module is enabled or not.
*/
function email_verify_activated() {
return (bool) variable_get('email_verify_active', 0);
}
Functions
Name![]() |
Description |
---|---|
email_verify_access_people_email_verify | Access callback for the page at admin/people/email_verify. |
email_verify_activated | Determine if Email Verify is enabled. |
email_verify_check | Verifies whether the given mail address exists. |
email_verify_edit_validate | Additional validation for the user form. |
email_verify_form_contact_personal_form_alter | Implements hook_form_FORM_ID_alter() for the contact_personal form. |
email_verify_form_contact_site_form_alter | Implements hook_form_FORM_ID_alter() for the contact_site form. |
email_verify_form_registration_form_alter | Implements hook_form_FORM_ID_alter(). |
email_verify_form_user_profile_form_alter | Implements hook_form_FORM_ID_alter() for the user_profile form. |
email_verify_form_user_register_form_alter | Implements hook_form_FORM_ID_alter() for the user_register form. |
email_verify_help | Implements hook_help(). |
email_verify_menu | Implements hook_menu(). |
email_verify_permission | Implements hook_permission(). |