You are here

function hosting_quota_node_update in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 quota/hosting_quota.module \hosting_quota_node_update()

Implements hook_node_update().

1 call to hosting_quota_node_update()
hosting_quota_node_insert in quota/hosting_quota.module
Implements hook_node_insert().

File

quota/hosting_quota.module, line 302
Implement quota's for the resource used by client.

Code

function hosting_quota_node_update($node) {
  if ($node->type == 'client') {
    if (user_access('edit all quotas')) {
      foreach ($node as $field => $value) {
        if (substr($field, 0, 6) == 'quota-') {
          $quota = substr($field, 6);

          // If no value was entered use the default value for this resource
          if (!$value) {
            $value = variable_get("hosting_quota_default_{$quota}", 0);
          }
          hosting_quota_set_limit($node->nid, $quota, $value);
        }
      }
    }
  }
}