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.
hmmmm, I think he wants to know how to get he entities if the metadata doesn't even exists..
Like what if "name_initial" doesn't even exists in the system.. eg
$entity = new ElggObject();/*some code here*/if($some_condition) {}else{$entity->name_initial = "A"
}
So in this case only those entities how satisfy the condition will have the metadata other will now even have it.
LOLZ ;-)
"name_initial" is metadata on my Groups AlphaSort customization ;-X
and so.. it exists on my test site.
I think he asked for "get all object entities which do not have a metadata of some name (let's say mimetype)..."
-->
wants to fetch entities by metadata where metadata value != "blahblah"...
Which is exactly what I coded in the API call parms and.. it works LOLZ ;-)
Elgg API has provision to specify <metadata> <operator> <value>
read up in engine/lic/ metadata.php for the calling sequence -
all I did was to code as the API allows.
If he really want to fetch enbtities which do not have metadata named as such...
Then he will have to copy the typical metadata query generated by metadata.php code and
re-hash a new very custom call on the meta data/strings table probably using (L/R) outer JOIN and work back to the entities that do not have that metadata as named -- a somewhat messy join, join, join...
I do that believe he wants to fetch by metadata where entitiy's metadata value is not equal to "some-value" -- but **he needs to come back here and qualify his intent while we go on with out philosophicals on the Elgg API ;-P
Well the discussion is very interesting :)
I was going to get entities without some metadata at all (not with metadata 'mimetype' != 'some value', but those without metadata 'mimetype' of any value). In other words (actually DhrupDeScoop's words) I was interested in fetching entities which do not have metadata named as'mimetype'.
I have discovered a workaround of my problem. I will not place it here because it has nothing to do with fetching entities and it is rather 'a brutal force' solution.
However it is good to hear that I should probably write my own query to achieve that. Maybe it will be useful in the future.
Thanks for all your suggestions :)
A view is a component that can be used to create a page. The sidebar is a view. The header is a view.
The "pages" are the controller in the MVC. The request for the page is routed through Elgg to a page handler (the first part of the controller). The page handler could pull in the views to create the page or it could include an extrenal page script. Most of the original Elgg plugins put most of the controller logic into these separate page scripts.
Tidypics has a better code layout than most of those original plugins but putting the page controllers into a pages directory. (In the same way, action controller are in action directories.)
I would definitely encourage putting your pages into a separate pages directory and as well, isolating your model code into functions located in separate files (not embedded in action files for example). I usually put my model functions in a models directory (eg. models/model.php) although other plugins use a lib directory for the same purpose.
I got it. It is much more clear now. 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.