You are here

function imagepicker_get_enabled_group in Image Picker 6.2

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_get_enabled_group()
  2. 5 imagepicker.module \imagepicker_get_enabled_group()
  3. 7 imagepicker.functions.inc \imagepicker_get_enabled_group()

get enabled groups that have images. usually just one

2 calls to imagepicker_get_enabled_group()
imagepicker_browse_groups_form in ./imagepicker.functions.inc
all the groups for the current user which have images attached
imagepicker_groups_list in ./imagepicker.group.inc

File

./imagepicker.functions.inc, line 1541
Imagepicker functions

Code

function imagepicker_get_enabled_group($account = FALSE) {
  if (!variable_get('imagepicker_groups_enabled', 0)) {
    return FALSE;
  }
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $result = db_query("\n  SELECT DISTINCT g.gid, g.group_name\n  FROM {imagepicker_user_groups} g, {imagepicker_group_images} i\n  WHERE g.uid=%d AND g.gid = i.gid AND g.state=1", array(
    $user->uid,
  ));
  $ct = 0;
  while ($row = db_fetch_array($result)) {
    $data[] = $row['gid'];
    $ct++;
  }
  if ($ct) {
    return $data;
  }
  return FALSE;
}