aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metadata.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-05 17:06:35 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-05 17:06:35 +0000
commit7dbc5cd43f911a381011f4d220a8490f3049c27d (patch)
tree3c9e6a35be9fd140bcfcaf407e9c953f578b1a1c /engine/lib/metadata.php
parentf98e97d304f47243d367c66a740ad653912ea57d (diff)
downloadelgg-7dbc5cd43f911a381011f4d220a8490f3049c27d.tar.gz
elgg-7dbc5cd43f911a381011f4d220a8490f3049c27d.tar.bz2
Fixes for metadata and for the run order.
git-svn-id: https://code.elgg.org/elgg/trunk@817 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r--engine/lib/metadata.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 44474c7d6..94c0b7b2c 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -388,7 +388,7 @@
* @param string $order_by Optional ordering.
* @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
*/
- function get_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $limit = 10, $offset = 0, $order_by = "e.time_created desc", $site_guid = 0)
+ function get_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "e.time_created desc", $site_guid = 0)
{
global $CONFIG;
@@ -401,6 +401,7 @@
$offset = (int)$offset;
$order_by = sanitise_string($order_by);
$site_guid = (int) $site_guid;
+ $owner_guid = (int) $owner_guid;
if ($site_guid == 0)
$site_guid = $CONFIG->site_guid;
@@ -417,7 +418,9 @@
if ($meta_value!="")
$where[] = "m.value_id='$meta_v'";
if ($site_guid > 0)
- $where[] = "e.site_guid = {$site_guid}";
+ $where[] = "e.site_guid = {$site_guid}";
+ if ($owner_guid > 0)
+ $where[] = "e.owner_guid = {$owner_guid}";
$query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}metadata m on e.guid = m.entity_guid where";
foreach ($where as $w)
@@ -440,7 +443,7 @@
* @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
* @return array List of ElggEntities
*/
- function get_entities_from_metadata_multi($meta_array, $entity_type = "", $entity_subtype = "", $limit = 10, $offset = 0, $order_by = "e.time_created desc", $site_guid = 0)
+ function get_entities_from_metadata_multi($meta_array, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "e.time_created desc", $site_guid = 0)
{
global $CONFIG;
@@ -468,6 +471,8 @@
$limit = (int)$limit;
$offset = (int)$offset;
$order_by = sanitise_string($order_by);
+ $owner_guid = (int) $owner_guid;
+
$site_guid = (int) $site_guid;
if ($site_guid == 0)
$site_guid = $CONFIG->site_guid;
@@ -480,6 +485,8 @@
$where[] = "e.subtype = {$entity_subtype}";
if ($site_guid > 0)
$where[] = "e.site_guid = {$site_guid}";
+ if ($owner_guid > 0)
+ $where[] = "e.owner_guid = {$owner_guid}";
$query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e {$join} where";
foreach ($where as $w)