So I figured out how to sort groups alphabetically and have that result paginated:
$group_options["pagination"] = true;
$group_options["limit"] = 20;
$group_options["joins"] = array("JOIN " . $dbprefix . "groups_entity ge ON e.guid = ge.guid");
$group_options["order_by"] = "ge.name ASC";
But for a small "directory" group widget I would like to also limit that view to a sub-set, i.e. for example only show groups that start with the letters "A to E" or something like that.
Since I have no idea about DB queries and just found the above on this site, I am a bit at all loss on how to modifiy the 3rd line (4th line?) to only get those groups I want.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Krischan@krischan
Krischan - 0 likes
- Brett@brett.profitt
Brett - 0 likes
- rjcalifornia@rjcalifornia
rjcalifornia - 0 likes
You must log in to post replies.this is not possible with Elgg at the moment?
Yes, it's possible. You will need to learn some SQL and regexp, then add a where clause to your query. Something like $group_options['wheres'][] = "ge.name REGEXP '^[a-eA-E].*'
Good tip, thanks brett