You are here

function hosting_client_validate in Hosting 5

Same name and namespace in other branches
  1. 6.2 client/hosting_client.module \hosting_client_validate()
  2. 7.4 client/hosting_client.module \hosting_client_validate()
  3. 7.3 client/hosting_client.module \hosting_client_validate()

Implementation of hook_validate()

File

client/hosting_client.module, line 184

Code

function hosting_client_validate(&$node) {
  $nid = db_result(db_query("SELECT nid FROM {hosting_client} WHERE email='%s'", $node->email));
  if ($nid) {
    if ($node->nid != $nid) {
      form_set_error('email', t("Email address already exists."));
    }
  }
  if (!$node->nid) {
    if ($node->email != $node->email_confirm) {
      form_set_error('email_confirm', t("Email addresses do not match"));
    }
  }
  if (!valid_email_address($node->email)) {
    form_set_error('email', t("Email address invalid."));
  }
}