You are here

function _photos_access_userlist in Album Photos 7.3

Same name and namespace in other branches
  1. 8.5 photos_access/photos_access.module \_photos_access_userlist()
  2. 8.4 photos_access/photos_access.module \_photos_access_userlist()
  3. 6.0.x photos_access/photos_access.module \_photos_access_userlist()

List of users who have access to album.

1 call to _photos_access_userlist()
photos_access_node_load in photos_access/photos_access.module
Implements hook_node_load().

File

photos_access/photos_access.module, line 395

Code

function _photos_access_userlist($id, $collaborate = FALSE) {
  $result = db_query('SELECT u.uid, u.name FROM {users} u
    INNER JOIN {photos_access_user} a ON u.uid = a.uid
    WHERE a.id = :id AND a.collaborate = :collaborate', array(
    ':id' => $id,
    ':collaborate' => $collaborate ? 1 : 0,
  ));
  $users = array();
  foreach ($result as $a) {
    $u = new stdClass();
    $u = $a;
    $u->username = theme('username', array(
      'account' => $a,
    ));
    $users[] = $u;
  }
  return $users;
}