aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/relationships.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 16:02:20 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 16:02:20 +0000
commita3eee5aa15c96727a3166b738d7e0b07bf5ab1ba (patch)
tree1007b91e4e5deaf1d46c07aeca469264df94239f /engine/lib/relationships.php
parent79d59633b62577ae6d1d889bae14180be4e95727 (diff)
downloadelgg-a3eee5aa15c96727a3166b738d7e0b07bf5ab1ba.tar.gz
elgg-a3eee5aa15c96727a3166b738d7e0b07bf5ab1ba.tar.bz2
Fix for previous
git-svn-id: https://code.elgg.org/elgg/trunk@585 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/relationships.php')
-rw-r--r--engine/lib/relationships.php8
1 files changed, 4 insertions, 4 deletions
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