You are here

function hosting_site_quota_exceeded in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 site/hosting_site.quota.inc \hosting_site_quota_exceeded()
  2. 7.3 site/hosting_site.quota.inc \hosting_site_quota_exceeded()

Check for quotas and return an appropriate error message to the site creation form.

1 call to hosting_site_quota_exceeded()
hosting_site_validate in site/hosting_site.form.inc
Implements hook_validate().
1 string reference to 'hosting_site_quota_exceeded'
hosting_site_validate in site/hosting_site.form.inc
Implements hook_validate().

File

site/hosting_site.quota.inc, line 41
Quota-relaled hooks for the Hosting site module.

Code

function hosting_site_quota_exceeded($node) {
  $client = hosting_get_client_by_uname($node->client);
  $client = node_load($client->nid, NULL, TRUE);
  $under_quota = hosting_quota_check($client->nid, 'sites');
  $limit = $client->quota['sites']['limit'];
  if (!$under_quota && !empty($limit)) {
    return t('@client has reached their site quota of @sites. No new sites can be added unless an existing site is deleted or the site quota is increased.', array(
      '@client' => $client->title,
      '@sites' => $limit,
    ));
  }
  return FALSE;
}