aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/metadata.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index deddf8a14..8a77b69fb 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -659,8 +659,13 @@
$query .= " from {$CONFIG->dbprefix}entities e {$join} where";
foreach ($where as $w)
$query .= " $w and ";
- $query .= get_access_sql_suffix("e"); // Add access controls
- $query .= ' and ' . get_access_sql_suffix("m"); // Add access controls
+ $query .= get_access_sql_suffix("e"); // Add access controls
+
+ $mindex = 1;
+ foreach($meta_array as $meta_name => $meta_value) {
+ $query .= ' and ' . get_access_sql_suffix("m{$mindex}"); // Add access controls
+ $mindex++;
+ }
if (!$count) {
$query .= " order by $order_by limit $offset, $limit"; // Add order and limit