From a3eee5aa15c96727a3166b738d7e0b07bf5ab1ba Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 30 Apr 2008 16:02:20 +0000 Subject: Fix for previous git-svn-id: https://code.elgg.org/elgg/trunk@585 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/relationships.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/lib/relationships.php') diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index f6fa0f945..189bda989 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -403,16 +403,16 @@ $where[] = "e.owner_guid='$owner_guid'"; // Select what we're joining based on the options - $joinon = "r.guid_two=e.guid"; + $joinon = "e.guid = r.guid_two"; if (!$inverse_relationship) - $joinon = "r.guid_one=e.guid"; + $joinon = "e.guid = r.guid_one"; if ($count) { $query = "select count(distinct e.id) as total "; } else { $query = "select distinct e.* "; - } - $query .= " from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}entity_relationships r on $joinon where "; + } + $query .= " from {$CONFIG->dbprefix}entity_relationships r JOIN {$CONFIG->dbprefix}entities e on $joinon where "; foreach ($where as $w) $query .= " $w and "; $query .= " (e.access_id in {$access} or (e.access_id = 0 and e.owner_guid = {$_SESSION['id']}))"; // Add access controls -- cgit v1.2.3