You are here

function hosting_get_client_from_user in Hosting 7.4

Same name and namespace in other branches
  1. 5 client/hosting_client.access.inc \hosting_get_client_from_user()
  2. 6.2 client/hosting_client.access.inc \hosting_get_client_from_user()
  3. 7.3 client/hosting_client.access.inc \hosting_get_client_from_user()

Get relationships a user has with different clients.

Parameters

int $uid: The user to get the relationships for.

Return value

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

7 calls to hosting_get_client_from_user()
hosting_client_form_site_node_form_alter in client/hosting_client.module
Implements hook_form_FORM_ID_alter().
hosting_client_form_user_profile_form_alter in client/hosting_client.access.inc
Implements hook_form_FORM_ID_alter().
hosting_client_node_grants in client/hosting_client.access.inc
Implements hook_node_grants().
hosting_client_user_load in client/hosting_client.access.inc
Implements hook_user_load().
hosting_quota_node_view in quota/hosting_quota.module
Implements hook_node_view().

... See full list

File

client/hosting_client.access.inc, line 382
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 = :user", array(
    ':user' => $uid,
  ))) {
    foreach ($results as $result) {
      $clients[$result->client] = explode(',', $result->contact_type);
    }
  }
  return $clients;
}