From b73350925fb884e9c89758f3ebf49fabc16f9f92 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 18 Jul 2008 18:38:06 +0000 Subject: Container_guid is set intelligently for get_entities when owner_guid is set. git-svn-id: https://code.elgg.org/elgg/trunk@1477 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 7d7551a3d..40d709fe3 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1189,14 +1189,19 @@ if ($subtype!=="") $where[] = "subtype=$subtype"; if ($owner_guid != "") { - if (!is_array($owner_guid)) { + if (!is_array($owner_guid)) { + $owner_array = array($owner_guid); $owner_guid = (int) $owner_guid; $where[] = "owner_guid = '$owner_guid'"; - } else if (sizeof($owner_guid) > 0) { + } else if (sizeof($owner_guid) > 0) { + $owner_array = $owner_guid; // Cast every element to the owner_guid array to int $owner_guid = array_map("sanitise_int", $owner_guid); $owner_guid = implode(",",$owner_guid); $where[] = "owner_guid in ({$owner_guid})"; + } + if (is_null($container_guid)) { + $container_guid = array_merge(0,$owner_guid); } } if ($site_guid > 0) -- cgit v1.2.3