aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/relationships.php
diff options
context:
space:
mode:
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