To keep it quick and simple im having issues getting this sort mechanic down
$Order = "ge.name";
$GroupArray = elgg_get_entities(array(
'type' => 'group',
'order_by' => $Order . " " . $Sort,
'joins' => 'JOIN ' . $db_prefix . 'groups_entity ge',
'limit' => 10,
'pagination' => true,
'offset' => $Offset,
));
$Sort comes in either asc, or desc respectively, but it still doesnt sort it at all, while say using e.time_created does. Is there any reason for this and is there a possible work around?
(Using 1.8)
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.
- iionly@iionly
iionly - 0 likes
- Twitchy@Twitchy
Twitchy - 0 likes
You must log in to post replies.How about this?
You might want to refer to http://reference.elgg.org/1.8 sometimes. You can search for Elgg API functions and get the parameter list with some brief info. For example the 'joins' option expects an array. Also, the elgg_get_entities_*() functions make no use of the pagination option. That's for use with the elgg_list_entities_*() functions that return formatted output.
The join clause of yours was incomplete. If you have no connection between the elgg_get_entities() call for groups and the additional join you just get all group entities.
It makes me feel silly that I did not think of this seeing as I use those types of arrays for the several other get_entities I use. However this works wonderfully and completely solves my issue, thanks!