diff options
Diffstat (limited to 'mod/members/pages')
-rw-r--r-- | mod/members/pages/members/index.php | 36 | ||||
-rw-r--r-- | mod/members/pages/members/search.php | 55 |
2 files changed, 91 insertions, 0 deletions
diff --git a/mod/members/pages/members/index.php b/mod/members/pages/members/index.php new file mode 100644 index 000000000..330ef66bf --- /dev/null +++ b/mod/members/pages/members/index.php @@ -0,0 +1,36 @@ +<?php +/** + * Members index + * + */ + +$num_members = get_number_users(); + +$title = elgg_echo('members'); + +$options = array('type' => 'user', 'full_view' => false); +switch ($vars['page']) { + case 'popular': + $options['relationship'] = 'friend'; + $options['inverse_relationship'] = false; + $content = elgg_list_entities_from_relationship_count($options); + break; + case 'online': + $content = get_online_users(); + break; + case 'newest': + default: + $content = elgg_list_entities($options); + break; +} + +$params = array( + 'content' => $content, + 'sidebar' => elgg_view('members/sidebar'), + 'title' => $title . " ($num_members)", + 'filter_override' => elgg_view('members/nav', array('selected' => $vars['page'])), +); + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/mod/members/pages/members/search.php b/mod/members/pages/members/search.php new file mode 100644 index 000000000..5466a8246 --- /dev/null +++ b/mod/members/pages/members/search.php @@ -0,0 +1,55 @@ +<?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); |