diff options
Diffstat (limited to 'engine/lib/relationships.php')
-rw-r--r-- | engine/lib/relationships.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 486005c3f..8e3298a61 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -371,9 +371,10 @@ * @param int $limit * @param int $offset
* @param boolean $count Set to true if you want to count the number of entities instead (default false)
+ * @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
* @return array|int|false An array of entities, or the number of entities, or false on failure */ - function get_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0, $order_by = "time_created desc", $limit = 10, $offset = 0, $count = false) + function get_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0, $order_by = "time_created desc", $limit = 10, $offset = 0, $count = false, $site_guid = 0) { global $CONFIG; @@ -385,7 +386,10 @@ $owner_guid = (int)$owner_guid; $order_by = sanitise_string($order_by); $limit = (int)$limit; - $offset = (int)$offset; + $offset = (int)$offset;
+ $site_guid = (int) $site_guid;
+ if ($site_guid == 0)
+ $site_guid = $CONFIG->site_guid; $access = get_access_list(); @@ -400,7 +404,9 @@ if ($subtype) $where[] = "e.subtype=$subtype"; if ($owner_guid != "") - $where[] = "e.owner_guid='$owner_guid'"; + $where[] = "e.owner_guid='$owner_guid'";
+ if ($site_guid > 0)
+ $where[] = "e.site_guid = {$site_guid}"; // Select what we're joining based on the options $joinon = "e.guid = r.guid_one"; |