You are here

function imagepicker_get_grouplist in Image Picker 5.2

Same name and namespace in other branches
  1. 5 imagepicker.module \imagepicker_get_grouplist()
  2. 6.2 imagepicker.functions.inc \imagepicker_get_grouplist()
  3. 7 imagepicker.functions.inc \imagepicker_get_grouplist()
1 call to imagepicker_get_grouplist()
imagepicker_browse_groups_form in ./imagepicker.module
browse groups form

File

./imagepicker.module, line 3061
Enables permitted roles to upload images for insertion into configured nodes.

Code

function imagepicker_get_grouplist($account = FALSE) {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $grouplist = array(
    '0' => 'All',
  );
  $result = db_query("\n  SELECT DISTINCT g.gid, g.group_name, g.public\n  FROM {imagepicker_user_groups} g, {imagepicker_group_images} i\n  WHERE g.uid=%d AND g.gid = i.gid", array(
    $user->uid,
  ));
  while ($row = db_fetch_array($result)) {
    $grouplist[$row['gid']] = $row['group_name'] . (user_access('use public imagepicker') && variable_get('imagepicker_public_enabled', 1) ? $row['public'] ? ' - ' . t('Public') : ' - ' . t('Private') : '');
  }
  return $grouplist;
}