aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/groups/languages/en.php2
-rw-r--r--mod/groups/lib/groups.php33
-rw-r--r--mod/groups/start.php3
-rw-r--r--mod/groups/views/default/groups/sidebar/find.php8
4 files changed, 44 insertions, 2 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index b0c728b69..789a9efe8 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -58,6 +58,8 @@ $english = array(
'groups:viagroups' => "via groups",
'groups:group' => "Group",
'groups:search:tags' => "tag",
+ 'groups:search:title' => "Search for groups tagged with '%s'",
+ 'groups:search:none' => "No matching groups were found",
'groups:activity' => "Group activity",
'groups:enableactivity' => 'Enable group activity',
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index c0a8a9a94..ec75078eb 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -56,6 +56,39 @@ function groups_handle_all_page() {
echo elgg_view_page(elgg_echo('groups:all'), $body);
}
+function groups_search_page() {
+ elgg_push_breadcrumb(elgg_echo('search'));
+
+ $tag = get_input("tag");
+ $title = elgg_echo('groups:search:title', array($tag));
+
+ // groups plugin saves tags as "interests" - see groups_fields_setup() in start.php
+ $params = array(
+ 'metadata_name' => 'interests',
+ 'metadata_value' => $tag,
+ 'types' => 'group',
+ 'full_view' => FALSE,
+ );
+ $content = elgg_list_entities_from_metadata($params);
+ if (!$content) {
+ $content = elgg_echo('groups:search:none');
+ }
+
+ $sidebar = elgg_view('groups/sidebar/find');
+ $sidebar .= elgg_view('groups/sidebar/featured');
+
+ $params = array(
+ 'content' => $content,
+ 'sidebar' => $sidebar,
+ 'filter' => false,
+ 'buttons' => false,
+ 'title' => $title,
+ );
+ $body = elgg_view_layout('content', $params);
+
+ echo elgg_view_page($title, $body);
+}
+
/**
* List owned groups
*/
diff --git a/mod/groups/start.php b/mod/groups/start.php
index e04485bb2..4eaaa5a7b 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -181,6 +181,9 @@ function groups_page_handler($page) {
case 'all':
groups_handle_all_page();
break;
+ case 'search':
+ groups_search_page();
+ break;
case 'owner':
groups_handle_owned_page();
break;
diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php
index 181f437e3..c5c986759 100644
--- a/mod/groups/views/default/groups/sidebar/find.php
+++ b/mod/groups/views/default/groups/sidebar/find.php
@@ -4,7 +4,11 @@
*
* @package ElggGroups
*/
-$url = elgg_get_site_url() . 'groups/world';
-$body = elgg_view_form('groups/search', array('action' => $url, 'method' => 'get'));
+$url = elgg_get_site_url() . 'groups/search';
+$body = elgg_view_form('groups/search', array(
+ 'action' => $url,
+ 'method' => 'get',
+ 'disable_security' => true,
+));
echo elgg_view_module('aside', elgg_echo('groups:searchtag'), $body);