You are here

function _imagepicker_user_has_grouped_img in Image Picker 6.2

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

How many groups a user has with images

1 call to _imagepicker_user_has_grouped_img()
imagepicker_group_stats in ./imagepicker.functions.inc
statistics

File

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

Code

function _imagepicker_user_has_grouped_img($public = 'all', $account = FALSE) {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  if ($public == 'yes') {
    $subsql = "AND public = 1";
  }
  elseif ($public == 'no') {
    $subsql = "AND public = 0";
  }
  else {
    $subsql = "";
  }
  $result = db_query("SELECT count(DISTINCT i.img_id) AS ct FROM {imagepicker_group_images} i, {imagepicker_user_groups} g\n    WHERE g.uid = %d AND g.gid = i.gid {$subsql} ", array(
    $user->uid,
  ));
  $row = db_fetch_array($result);
  return $row['ct'];
}