You are here

function hosting_get_client in Hosting 6.2

Same name and namespace in other branches
  1. 5 client/hosting_client.module \hosting_get_client()
  2. 7.4 client/hosting_client.module \hosting_get_client()
  3. 7.3 client/hosting_client.module \hosting_get_client()

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()

11 calls to hosting_get_client()
hook_hosting_quota_get_usage in quota/hosting_quota.api.php
Definition of hook_hosting_quota_get_usage
hosting_client_platform_access_form in client/hosting_client.module
Page callback for the client platform access form.
hosting_client_platform_access_form_submit in client/hosting_client.module
Submit handler for the client platform access form.
hosting_client_user_form_submit in client/hosting_client.access.inc
Save the values submitted when editing or adding a user.
hosting_client_user_form_validate in client/hosting_client.access.inc
Validate the submission of a user form.

... See full list

File

client/hosting_client.module, line 115

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;
}