function hosting_site_allow_domain in Hosting 7.4
Same name and namespace in other branches
- 5 site/hosting_site.module \hosting_site_allow_domain()
- 6.2 site/hosting_site.module \hosting_site_allow_domain()
- 7.3 site/hosting_site.module \hosting_site_allow_domain()
Implements hook_allow_domain().
Disallow domains already used as any site's title/url, unless the site has been deleted.
See also
File
- site/
hosting_site.module, line 689 - Contains hook implementations for Hosting site module.
Code
function hosting_site_allow_domain($url, $params = array()) {
$query = "SELECT COUNT(n.nid) FROM {node} n\n JOIN {hosting_site} h ON n.nid = h.nid\n WHERE type = 'site' AND n.title = :title AND h.status <> :status";
$args[':title'] = $url;
$args[':status'] = HOSTING_SITE_DELETED;
if (isset($params['nid'])) {
$query .= " AND n.nid <> :nid";
$args[':nid'] = $params['nid'];
}
$result = !db_query($query, $args)
->fetchField();
return $result;
}