aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2013-03-30 15:46:49 -0400
committercash <cash.costello@gmail.com>2013-03-30 15:46:49 -0400
commit574e9aefd04a6ea75f53d20756edb6a04a31ba2b (patch)
tree964ba29b21fc2e058e0357b203f1ec976496f40b /mod
parent7f01abbe8ec3dc8e7626639732fd095e264c27c5 (diff)
downloadelgg-574e9aefd04a6ea75f53d20756edb6a04a31ba2b.tar.gz
elgg-574e9aefd04a6ea75f53d20756edb6a04a31ba2b.tar.bz2
Fixes #5304 handling metadata arrays in search for user profile data
Diffstat (limited to 'mod')
-rw-r--r--mod/search/search_hooks.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php
index 47351fb8a..92c6d700a 100644
--- a/mod/search/search_hooks.php
+++ b/mod/search/search_hooks.php
@@ -178,11 +178,20 @@ function search_users_hook($hook, $type, $value, $params) {
$entity->setVolatileData('search_matched_title', $title);
$matched = '';
- foreach ($profile_fields as $md) {
- $text = $entity->$md;
- if (stristr($text, $query)) {
- $matched .= elgg_echo("profile:{$md}") . ': '
- . search_get_highlighted_relevant_substrings($text, $query);
+ foreach ($profile_fields as $md_name) {
+ $metadata = $entity->$md_name;
+ if (is_array($metadata)) {
+ foreach ($metadata as $text) {
+ if (stristr($text, $query)) {
+ $matched .= elgg_echo("profile:{$md_name}") . ': '
+ . search_get_highlighted_relevant_substrings($text, $query);
+ }
+ }
+ } else {
+ if (stristr($metadata, $query)) {
+ $matched .= elgg_echo("profile:{$md_name}") . ': '
+ . search_get_highlighted_relevant_substrings($metadata, $query);
+ }
}
}