You are here

function hosting_get_client in Hostmaster (Aegir) 6

Get a client by name or nid.

This is really a shortcut to node_load()

@todo just load the freaking node instead of doing that select...

Parameters

$client: Either the nid or the client title

See also

node_load()

9 calls to hosting_get_client()
hook_hosting_quota_get_usage in modules/hosting/quota/hosting_quota.api.php
Definition of hook_hosting_quota_get_usage
hosting_client_user_form_submit in modules/hosting/client/hosting_client.access.inc
Save the values submitted when editing or adding a user.
hosting_client_user_form_validate in modules/hosting/client/hosting_client.access.inc
Validate the submission of a user form.
hosting_import_client in modules/hosting/client/hosting_client.module
Helper function to generate new client node during import.
hosting_site_hosting_quota_get_usage in modules/hosting/site/hosting_site.quota.inc
Implement hook_hosting_quota_get_usage

... See full list

1 string reference to 'hosting_get_client'
hosting_get_client_by_email in modules/hosting/client/hosting_client.module
Get a client by email

File

modules/hosting/client/hosting_client.module, line 104

Code

function hosting_get_client($client) {
  if (is_numeric($client)) {
    $result = db_result(db_query("SELECT n.nid FROM {hosting_client} h INNER JOIN {node} n ON n.nid = h.nid WHERE n.nid = %d", $client));
  }
  else {
    $result = db_result(db_query("SELECT c.nid FROM {hosting_client} c JOIN {node} n ON c.nid = n.nid WHERE n.title = '%s' AND n.type = 'client'", $client));
  }
  if ($result) {
    return node_load($result);
  }
  return false;
}