diff options
-rw-r--r-- | engine/lib/metastrings.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 4218659d9..0d472a18b 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -75,7 +75,7 @@ function get_metastring_id($string, $case_sensitive = TRUE) { $ids[] = $metaString->id; } return $ids; - } else { + } else if ($metaStrings) { $row = $metaStrings[0]; } } @@ -429,17 +429,19 @@ function elgg_get_metastring_based_objects($options) { $query .= get_access_sql_suffix('e'); // reverse order by - if ($options['reverse_order_by']) { + if (isset($options['reverse_order_by']) && $options['reverse_order_by']) { $options['order_by'] = elgg_sql_reverse_order_by_clause($options['order_by'], $defaults['order_by']); } if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE) { - if ($options['group_by'] = sanitise_string($options['group_by'])) { + if (isset($options['group_by'])) { + $options['group_by'] = sanitise_string($options['group_by']); $query .= " GROUP BY {$options['group_by']}"; } - if ($options['order_by'] = sanitise_string($options['order_by'])) { + if (isset($options['order_by']) && $options['order_by']) { + $options['order_by'] = sanitise_string($options['order_by']); $query .= " ORDER BY {$options['order_by']}, n_table.id"; } |