From c9eafde198c9b5d07489de2b5084849e8e314bfa Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 25 Jun 2008 17:36:06 +0000 Subject: get_tags can now take an array as owner_guid. git-svn-id: https://code.elgg.org/elgg/trunk@1129 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/tags.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 8648fb3f8..ee770b492 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -93,7 +93,12 @@ $entity_subtype = get_subtype_id($entity_type, $entity_subtype); $entity_type = sanitise_string($entity_type); - $owner_guid = (int) $owner_guid; + if (is_array($owner_guid)) { + foreach($owner_guid as $key => $val) + $owner_guid[$key] = (int) $val; + } else { + $owner_guid = (int) $owner_guid; + } if ($site_guid < 0) { $site_guid = $CONFIG->site_id; @@ -120,14 +125,16 @@ if ($entity_type != "") { $query .= " and e.type = '{$entity_type}' "; } - if ($owner_guid > 0) { + if (is_array($owner_guid)) { + $query .= " and e.owner_guid in (".implode(",",$owner_guid).")"; + } else if (is_int($owner_guid)) { $query .= " and e.owner_guid = {$owner_guid} "; } $query .= " and (e.access_id in {$access} or (e.access_id = 0 and e.owner_guid = {$_SESSION['id']}))"; $query .= " group by msvalue.string having total > {$threshold} order by total desc limit {$limit} "; - + return get_data($query); } -- cgit v1.2.3