I have a problem with 'order by' on elgg_get_entities(). Because this doesn't work, i mean, i set this to order by title but it doesn't work for me and i was trying with elgg_get_entities_from_metadata function.
Any body can help me with that?
this is my peace of code:
$calendars = elgg_get_entities_from_metadata(array(
'types' => 'object',
'subtypes' => '3key_calendar',
'owner_guid' => $owner->guid,
'container_guids' => $owner->guid,
'order by' => array('name' => 'title', 'direction' => ASC, 'as' => text)
));
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.
- Andras Szepeshazi@aszepeshazi
Andras Szepeshazi - 0 likes
- Guillermo Salas@guispro
Guillermo Salas - 0 likes
You must log in to post replies.Title is not stored as metadata, it is part of the core objects_entity table. You'll have to use a custom join and order_by clause. Something like this (untested):
$calendars = elgg_get_entities_from_metadata(array(
'types' => 'object',
'subtypes' => '3key_calendar',
'owner_guid' => $owner->guid,
'container_guids' => $owner->guid,
'joins' => array("INNER JOIN {$CONFIG->dbprefix}objects_entity o ON (e.guid = o.guid)"),
'order_by' => 'o.title'
));
Thank Andras... this code works for me now... thanks a lot