I have some entities with a unixtime stamp as a metadata value. I would like to sort these entities based off that metadata value. How would this be done?
Example: $entity->customtime = time();
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.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- iionly@iionly
iionly - 0 likes
You must log in to post replies.You already asked about it here.
Your question is similar to the previous one.
Add
'order_by_metadata' => [
'name' => 'customtime',
'direction' => 'DESC',
'as' => 'integer',
],
as option within elgg_get_entities or elgg_list_entities. DESC or ASC sets the direction the results are ordered.