You are here

function subuser_get_subusers in Subuser 6

API function to get the subuser accounts of a specified parent account.

Parameters

$uid: [optional] The uid of a potential parent account. Defaults to current user.

Return value

Array of subuser uids.

4 calls to subuser_get_subusers()
subuser_block_subusers in ./subuser.module
Function to block subusers when a parent is blocked.
subuser_create_form in ./subuser.pages.inc
Create subuser form.
subuser_unblock_subusers in ./subuser.module
Function to unblock subusers when a parent is unblocked.
subuser_user in ./subuser.module
Implementation of hook_user().

File

./subuser.module, line 420
Allows users of a particular role to create sub user account in another role.

Code

function subuser_get_subusers($uid = NULL) {
  if ($uid == NULL) {
    $uid = $GLOBALS['user']->uid;
  }
  $users = array();
  $results = db_query("SELECT uid FROM {subuser_relationship} WHERE parent_id = %d", $uid);
  while ($u = db_fetch_array($results)) {
    $users[$u['uid']] = $u['uid'];
  }
  return $users;
}