How can I list only the latest entity of each user?
$options = array(
'type' => 'object',
'subtype' => 'file',
);
$files = elgg_list_entities($options);
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.
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 0 likes
- adrew22a@drew22a
adrew22a - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 1 like
- adrew22a@drew22a
adrew22a - 0 likes
- iionly@iionly
iionly - 0 likes
- adrew22a@drew22a
adrew22a - 0 likes
You must log in to post replies.Try this:
I'm not trying to list a single owners entities of a subtype. I want to list all entities of a subtype but only want to show the latest one entity of each user. If someone posted 5 times to the entity "file" I just want to show the latest post not all 5 and then I want to show the rest for all users that posted to the subtype "file"
'group_by' => 'e.owner_guid' might do the trick
Ismayil this was so close and way easier then what I was trying to do! The only issue is its show the oldest post not the newest post. Any ideas?
Maybe some finetuning is necessary, e.g. additionally to 'group_by' also
Just try with appending either ASC or DESC to the `group_by` and `order_by ' options values to see how it changes the order.
Im trying to use this example I found :
Implemented in Elgg like the following:
But this doesn't seem to work still. Any ideas?