From 4cf87cd1f558593fe7047440806bc6b7d32e83ee Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 2 May 2008 12:40:38 +0000 Subject: The system now uses the site GUID to get and set entity data. Also, installation is a great deal more visual. git-svn-id: https://code.elgg.org/elgg/trunk@621 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/relationships.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'engine/lib/relationships.php') 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"; -- cgit v1.2.3