function groups_search_page() { elgg_push_breadcrumb(elgg_echo('search')); $tag = get_input("tag"); $display_query = _elgg_get_display_query($tag); $title = elgg_echo('groups:search:title', array($display_query)); // groups plugin saves tags as "interests" - see groups_fields_setup() in start.php $params = array('metadata_name' => 'interests', 'metadata_value' => $tag, 'type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:search:none')); $content = elgg_list_entities_from_metadata($params); $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => false, 'title' => $title); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
<?php /** * Overrule to group search page */ elgg_push_breadcrumb(elgg_echo('search')); $db_prefix = elgg_get_config('dbprefix'); $tag = get_input("tag"); $display_query = _elgg_get_display_query($tag); $query = sanitise_string($tag); $title = elgg_echo('groups:search:title', [$display_query]); $content = false; if (!empty($query)) { $params = ['type' => 'group', 'full_view' => false]; // search all profile fields $profile_fields = array_keys(elgg_get_config('group')); if (!empty($profile_fields)) { $params['joins'] = ["JOIN {$db_prefix}groups_entity ge ON e.guid = ge.guid", "JOIN {$db_prefix}metadata md on e.guid = md.entity_guid", "JOIN {$db_prefix}metastrings msv ON md.value_id = msv.id"]; } else { $params['joins'] = ["JOIN {$db_prefix}groups_entity ge ON e.guid = ge.guid"]; } $where = "ge.name LIKE '%{$query}%' OR ge.description LIKE '%{$query}%'"; if (!empty($profile_fields)) { // get the where clauses for the md names // can't use egef_metadata() because the n_table join comes too late. // $clauses = elgg_entities_get_metastrings_options('metadata', array( // 'metadata_names' => $profile_fields, // )); // $params['joins'] = array_merge($clauses['joins'], $params['joins']); $tag_name_ids = []; foreach ($profile_fields as $field) {
<?php /** * Members search page * */ $query = get_input("member_query"); if (empty($query)) { forward("members"); } $limit = get_input("limit"); $offset = get_input("offset"); $display_query = _elgg_get_display_query($query); $title = elgg_echo('members:title:search', array($display_query)); $options = array(); $options['query'] = $query; $options['type'] = "user"; $options['offset'] = $offset; $options['limit'] = $limit; $results = elgg_trigger_plugin_hook('search', 'user', $options, array()); $count = $results['count']; $users = $results['entities']; if (!empty($users)) { $content = elgg_view_entity_list($users, array('count' => $count, 'offset' => $offset, 'limit' => $limit, 'full_view' => false, 'list_type_toggle' => false, 'pagination' => true)); } else { $content = elgg_echo("notfound"); } $params = array('title' => $title, 'content' => $content, 'sidebar' => elgg_view('members/sidebar')); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body);
<?php /** * Members search page * */ if ($vars['search_type'] == 'tag') { $tag = get_input('tag'); $display_query = _elgg_get_display_query($tag); $title = elgg_echo('members:title:searchtag', array($display_query)); $options = array(); $options['query'] = $tag; $options['type'] = "user"; $options['offset'] = $offset; $options['limit'] = $limit; $results = elgg_trigger_plugin_hook('search', 'tags', $options, array()); $count = $results['count']; $users = $results['entities']; $content = elgg_view_entity_list($users, array('count' => $count, 'offset' => $offset, 'limit' => $limit, 'full_view' => false, 'list_type_toggle' => false, 'pagination' => true)); } else { $name = sanitize_string(get_input('name')); $display_query = _elgg_get_display_query($name); $title = elgg_echo('members:title:searchname', array($display_query)); $db_prefix = elgg_get_config('dbprefix'); $params = array('type' => 'user', 'full_view' => false, 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'wheres' => array("(u.name LIKE \"%{$name}%\" OR u.username LIKE \"%{$name}%\")")); $content .= elgg_list_entities($params); } $params = array('title' => $title, 'content' => $content, 'sidebar' => elgg_view('members/sidebar')); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body);