Hello -
I am modifying a plugin and am trying to sort a subtype by the value of one of its metadata properties. I have been using elgg_list_entities and then order_by to sort the results.
This code below works and does return the results ordered by 'amount' -- but I can't change the direction from ASC to DESC. I'd also like to be able to sort the results to find all the object subtypes that fall within a range of value in the amount field (ie, between 100 and 200).
I have also tried using order_by_metadata and elgg_get_entities_from_metadata -- but with both of those, I wasn't able to sort the results at all.
If anyone can help in identifying the problem with this code or if there is another function I should be using, it'd be a huge help.
Thanks.
$content = elgg_list_entities(array(
'type' => 'object',
'subtype' => 'electric',
'full_view' => true,
'view_toggle_type' => false,
'limit' => 10,
'pagination' => true,
'order_by' => array(
'name' => 'amount',
'direction' => 'DESC',
'as' => integer)
));
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.
- Jerome Bakker@jeabakker

Jerome Bakker - 0 likes
You must log in to post replies.You should be able to use elgg_list_entities_from_metadata() and 'order_by_metadata'.
Please check if you have 'integer' as a string, in you example that is missing.