0
votes

Apologies if this question seems to elementary. I'm a Drupal newbie with some knowledge of PHP and MySQL, and am wondering if it is possible to integrate the functionality of the Email Verify module to the Drupal Guestbook module. The latter comprises of a form with email field which I want to be validated using the Email Verify module, whose configuration options only allow checking on the User Registration Form and the User Profile Form. I'd like to expand the functionalities to include the Guestbook, and possibly other forms on the site in the future. Any suggestions on how I can get started would be appreciated.

P.S - I'm using Drupal v7.39

1

1 Answers

0
votes

The function that validated the emails in the email verify module is this:

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);
    }
  }
}

So you could do a form_alter or a form_FORMID_alter on your form and add this: $form['#validate'][] = 'email_verify_edit_validate'; But only if the input field on your form has the element named mail.

Alternatively, you could create your own validation function that implements part of the email verify function, specifically the email_verify_check($form_state['input']['mail']) function part, replacing the ['mail'] with the appropriate id of your form element.