From 2d0ceebc979903474e445b04cd2dbe406a8b1f3f Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 25 Jun 2008 18:07:16 +0000 Subject: Search and metadata functions now support multiple user GUIDs git-svn-id: https://code.elgg.org/elgg/trunk@1134 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/metadata.php | 12 ++++++++++-- search/index.php | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 11f40e51d..51d932c1a 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -459,7 +459,13 @@ if ($order_by == "") $order_by = "e.time_created desc"; $order_by = sanitise_string($order_by); $site_guid = (int) $site_guid; - $owner_guid = (int) $owner_guid; + if (is_array($owner_guid)) { + foreach($owner_guid as $key => $guid) { + $owner_guid[$key] = (int) $guid; + } + } else { + $owner_guid = (int) $owner_guid; + } if ($site_guid == 0) $site_guid = $CONFIG->site_guid; @@ -477,7 +483,9 @@ $where[] = "m.value_id='$meta_v'"; if ($site_guid > 0) $where[] = "e.site_guid = {$site_guid}"; - if ($owner_guid > 0) + if (is_array($owner_guid)) { + $where[] = "e.owner_guid in (".implode(",",$owner_guid).")"; + } else if ($owner_guid > 0) $where[] = "e.owner_guid = {$owner_guid}"; if (!$count) { diff --git a/search/index.php b/search/index.php index e5d230847..5718047ad 100644 --- a/search/index.php +++ b/search/index.php @@ -24,8 +24,12 @@ if (!$md_type = get_input('tagtype')) { $md_type = ""; } + $owner_guid = get_input('owner_guid',0); + if (substr_count($owner_guid,',')) { + $owner_guid = explode(",",$owner_guid); + } - $body = list_entities_from_metadata($md_type, $tag, $objecttype, $subtype); + $body = list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid); $body = elgg_view_layout('one_column',$body); page_draw(sprintf(elgg_echo('searchtitle'),$tag),$body); -- cgit v1.2.3