I need to write a user page that shows all the images that a user owns, a sort of search by tags (clicking on the word) but by owner. I need it to collect every image a user uploads on my site.
The search form doesn't have a 'owner' option and I can't find a specific function in the documentation.
What function can I use to print them? Any suggestion?
Thanks
Comments
You have two ways to get them instead:
a) Use the object model (recommended)
b) Use a MySQL query
c) Use the object model to assign a tag to each image based on the owner name and then search that one (we use a tag "author_<name>" for credits for example we do that manually as 3rd party authors are no "users" on our site)
uhm... I already use the object model to assign the owner to the image while uploading (using `$image->setOwner('bob');`), my idea was to recall that by `$_zp_current_image->getOwner();`, modifying somehow search.php... could be that a good idea?
I haven't clearly understood how a search is done yet, but I think I could clone the model of search by tag and substitute the control on tag with the control on the owner...
Modifying the search is surely an option but not recommended because of upgrade. The best would be to open a ticket so it is actually added. Probably it was just forgotten or something. My colleague will be able to answer this I guess.
`$personality->theme_content($map, $_GET['owner']);`
and then used to skip image prints that don't have the requested owner
`if ($_zp_current_image->getOwner() == $owner || $owner == '') { print the thumbnail }`
This worked for me, but if you said Stephan could have a cleaner and more general way to get it, I'll wait. However, it will be a nice feature having it among the search fields, in a future release.
`$this->search_structure['owner'] = gettext('Owner');`
To the constructor of the search class. Then the field shows up in the option list and can be checked to cause it to be included in on the search form.
I am sure that it is just an oversite that it is not already included. I will make sure it is part of 1.4.4
I simply added `$this->search_structure['owner'] = gettext('Owner');` to the class-search _constructor, but when I search by owner it shows me only 11 results, while that user (the admin) has uploaded about 50 images.
I checked the images not shown in search results, they belongs to that user too.
(This is, of course, the problem with just looking at database fields. But I do not know how the serach could do otherwise.)
It needs to "save" every pages (even without changing anything) in the album/image control panel in order to set the right parameters for every image.
after the lines that read:
`
$alb = $this->album;
if (!is_null($alb)) {
`
add:
`
if (!$this->get('owner')) {
$this->setOwner($alb->getOwner());
}
`
Of course, this requires a metadata refresh if the album owner is changed after the image is discovered.
This will be added to the 1.4.4 release
However it could be nice having an option to change every image owner while changing album owner.
My 2 cents
`
<?php if (strlen($tagstring) > 0) { ?>
`
but really I would like this to be a link and a tag allowing clicking on the owner to do a tag search. I see above that you are recommending using the object model to "assign a tag to each image based on the owner name". Can you provide some tips on how to do this?
Thanks
The link for "owner" should look something like:
`domain.com/page/search//?searchfields=owner`
where `` is the owner of the object
Please post the full error message incl. line numbers etc.
I did a little testing. Seems that the link needs to have a page # included to work properly, so try:
`http://skishots.calgaryalpine.com/page/search/paul/1?searchfields=owner`
Not sure why that is the case, maybe a problem with rewrite rules.
`http://skishots.calgaryalpine.com/page/search/paul/1?searchfields=owner`
or
`http://skishots.calgaryalpine.com/page/search/paul?searchfields=owner`
Will work. but
`http://skishots.calgaryalpine.com/page/search/paul/?searchfields=owner`
results in the target for "owner" being "paul/". It is a rewrite issue, but I think there is nothing that can be done for it.