You are here

function hosting_client_users in Hostmaster (Aegir) 6

Return a list of users for a given client.

Parameters

$node: Client node (as nid or node object).

Return value

Array of user names indexed by uid.

2 calls to hosting_client_users()
hosting_client_form in modules/hosting/client/hosting_client.module
Implementation of hook_form().
hosting_client_view in modules/hosting/client/hosting_client.module
Implementation of hook_view().

File

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

Code

function hosting_client_users($node) {
  if (is_object($node)) {
    $node = $node->nid;
  }
  elseif (!is_numeric($node)) {
    return array();
  }
  $users = array();
  $q = db_query("SELECT u.uid, u.name FROM {hosting_client_user} h INNER JOIN {users} u ON u.uid = h.user WHERE h.client = %d", $node);
  while ($result = db_fetch_array($q)) {
    $users[$result['uid']] = $result['name'];
  }
  return $users;
}