You are here

function hook_domain_validate_alter in Domain Access 6.2

Same name and namespace in other branches
  1. 8 domain/domain.api.php \hook_domain_validate_alter()
  2. 7.3 domain.api.php \hook_domain_validate_alter()
  3. 7.2 domain.api.php \hook_domain_validate_alter()

Alter the validation step of a domain record.

This hook allows modules to change or extend how domain validation happens. Most useful for international domains or other special cases where a site wants to restrict domain creation is some manner.

NOTE: This does not apply to Domain Alias records.

Parameters

&$error_list: The list of current vaidation errors. Modify this value by reference. If you return an empty array or NULL, the domain is considered valid.

$subdomain: The HTTP_HOST string value being validated, such as one.example.com. Note that this is checked for uniqueness separately. This value is not modifiable.

Return value

No return value. Modify $error_list by reference. Return an empty array or NULL to validate this domain.

See also

domain_valid_domain()

1 invocation of hook_domain_validate_alter()
domain_valid_domain in ./domain.module
Validate the domain against all correctable errors.

File

./API.php, line 817
API documentation file.

Code

function hook_domain_validate_alter(&$error_list, $subdomain) {

  // Only allow TLDs to be .org for our site.
  if (substr($subdomain, -4) != '.org') {
    $error_list[] = t('Only .org domains may be registered.');
  }
}