You are here

function hosting_get_client_by_uname in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 client/hosting_client.module \hosting_get_client_by_uname()
  2. 7.4 client/hosting_client.module \hosting_get_client_by_uname()

Get a client by internal name.

Parameters

string $uname: The internal name of this client.

Return value

object|bool The client node object of FALSE.

See also

hosting_get_client()

2 calls to hosting_get_client_by_uname()
hosting_import_client in client/hosting_client.module
Helper function to generate new client node during import.
hosting_site_quota_exceeded in site/hosting_site.quota.inc
Check for quotas and return an appropriate error message to the site creation form.
1 string reference to 'hosting_get_client_by_uname'
hosting_client_form in client/hosting_client.module
Implements hook_form().

File

client/hosting_client.module, line 175

Code

function hosting_get_client_by_uname($uname) {
  $result = db_query("SELECT c.nid FROM {hosting_client} c JOIN {node} n ON c.nid = n.nid WHERE c.uname = :uname AND n.type = :type", array(
    ':uname' => $uname,
    ':type' => 'client',
  ))
    ->fetchField();
  if ($result) {
    return node_load($result);
  }
  else {
    return FALSE;
  }
}