You are here

function hosting_get_client_from_user in Hostmaster (Aegir) 6

Get relationships a user has with different clients.

Parameters

$uid: The user to get the relationships for.

Return value

An array of clients and their contact type relationships to the specified user.

5 calls to hosting_get_client_from_user()
hosting_client_user in modules/hosting/client/hosting_client.access.inc
Implements hook_user().
hosting_node_grants in modules/hosting/client/hosting_client.access.inc
Implements hook_node_grants().
hosting_quota_nodeapi in modules/hosting/quota/hosting_quota.module
Implements hook_nodeapi().
hosting_site_validate in modules/hosting/site/hosting_site.form.inc
Implements hook_validate().
_hosting_client_site_default in modules/hosting/client/hosting_client.module
Get the default value of the client field for a site node.

File

modules/hosting/client/hosting_client.access.inc, line 265
Control client node access.

Code

function hosting_get_client_from_user($uid) {
  $clients = array();
  if ($results = db_query("SELECT client, contact_type FROM {hosting_client_user} WHERE user=%d", $uid)) {
    while ($result = db_fetch_array($results)) {
      $clients[$result['client']] = explode(',', $result['contact_type']);
    }
  }
  return $clients;
}