Hi. I'm working on a plugin modeled after the bookmarks plugin. However, I want to list the entities in order of 3 metadata elements then have the listing shown with subtitles. Specifically I have Country, City and Event_Date as metadata for my entities and I want the listing to show them as follows:
Australia
Melbourne
Listing 1 March 10 2015
Listing 2 April 9 2015
....
Sydney
Listing x March 23 2015
Canada
Toronto
Listing y June 1 2015
.....
So it first groups them by Country, then City then order by date (only those in the future).
I've been playing with elgg_list_entities_from_metadata() and using the order_by_metadata but can't get it to work the way I want. Right now I have multiple listings coming up for each entity. Am I going about this the right way? Some direction would be greatly appreciated. Or if there is a plugin that I can use as reference that would also be great.
I have this feeling I will need to break it down more to be able to insert the grouping titles...
Thanks
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.
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- John Hunter@jhunter
John Hunter - 0 likes
You must log in to post replies.To keep things clean, I would suggest writing custom JOIN clauses for metadata and metastring tables, then use order by statement with your table aliases.
Let me see if I can find a decent example
You can look at the implementation of getAllEvents() method at https://github.com/arckinteractive/events_api/blob/master/classes/Events/API/Calendar.php. For your use case, you would add order by statement for metastring table aliases, e.g. 'order_by' => 'mss.string ASC, msre.string DESC, e.time_created ASC'
Thanks. I will take a look at this later tonight. Appreciate the quick help.