Hi,
I've been trying to get this done for the last two days but can't seem to get it right.
I'm currently listing objects in a widget via elgg_list_entities($options); :
$options = array(
'type' => 'object',
'subtype' => 'laud_item',
'container_guid' => $vars['entity']->owner_guid,
'limit' => $num,
'full_view' => FALSE,
'pagination' => FALSE,
);
elgg_list_entities($options);
This works perfectly and I was able to display the views the way I wanted...
Now here is my problem: I do have a bunch of objects in there that have the same metadata values. They are being listed twice of course. Is there a simple way to filter them out that they are only listed once? I do not want to delete them since I do in fact need them for something else.
So my current listing looks like this:
Item 1
Item 2
Item 3
Item 3
Item 1
Item 1
-------------
I'd like it to look like this:
Item 1 (3 times)
Item 2 (1 time)
Item 3 (2 times)
Anyway to get that done with elgg_list_entities() or is there another function that does this?
I know there is elgg_list_entities_from_relationships() but I wasn't able to get it done with that. Is there anyway to do it?
Help is much appreciated.
Thanks,
Tino
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.
- Alex Tanchoco@alextanchoco

Alex Tanchoco - 0 likes
You must log in to post replies.Hi Tino,
You may want to take a look at the PHP function
array_count_values() which returns an array with the values and their counts.
There are examples from this link:
http://php.net/manual/en/function.array-count-values.php
Alex