Hi,
I would like to get all tidypics' images which belong to a particular group. I can get all photos of the particular album in an easy way:
$params = array('types' => 'object', 'subtypes' => 'image', 'container_guid' => $album_guid);
$photos = elgg_get_entities($params);
but I can not of course get the images belonging to the group in this way, because the containers of all images are albums not groups. And the groups are containers of albums.
In other words I would like to get all images which are contained in all albums belonging to a particular group. How to accomplish this task? I can see that function elgg_get_entities has many possible options (like 'selects','wheres' and 'joins') but I can not find any good documentation with some examples of use.
I guess it is rather a simple problem. Could anyone help me?
Regards,
Robert
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.
- Jeff Tilson@jrtilson
Jeff Tilson - 0 likes
- Robert Koziol@rkoziol7
Robert Koziol - 0 likes
- Cash@costelloc
Cash - 0 likes
You must log in to post replies.Hey Rob, try grabbing all the of the albums belonging to a group ie:
$params = array('types' => 'object', 'subtypes' => 'album', 'container_guid' => $group_guid);
Then you can grab the images within each album. There might be a more graceful way of doing the same with the wheres and joins, but I'm not a DB guru
- Jeff
Jeff, thanks for your reply. I will follow your advice temporarily - but it is rather a workaround not a real solution. I would like to know how to achieve this by using one function invocation :)
Anyone?
Register for the create image event (or whatever it is called). In your callback, check if the album (container) has a container of group. If so, create a relationship betwen photo and group.
Now all you need to do is pull all photos that belong to the group using the relationship.