Hi there,
I'm trying to populate the owner's user album id in the search module.
I would like it populate under the field Owner.
Having some difficulties here but I'm pretty sure I'm close to get it...
So here's what I did in the SearchScan.inc at line ~240 at the end just before:
Quote:
$template->javascript('modules/search/HighlightResults.js');
I added this:
Quote:
$SearchScan =& $template->getVariableByReference('SearchScan');
global $gallery;
foreach($SearchScan['searchResults'] as $id=>$item) {
// Serban: add a link to user's album
list ($ret, $albumId) =
GalleryCoreApi::getPluginParameter('module', 'useralbum', 'albumId', $item['itemId']['ownerId']);
if ($ret) { return array($ret, null); }
$SearchScan['searchResults'][$id]['ownerAlbum'] = $albumId;
}
I called this function in SearchScan.tpl after this:
Quote:
{foreach from=$result.fields item=field}
{if isset($field.value)}
<li>
<span class="ResultKey"><strong>{$field.key}:</strong></span>
<span class="ResultData">{$field.value|default:" "|markup}</span>
</li>
{/if}
{/foreach}
I added this:
Quote:
<li>{$results.ownerAlbum}</li>
The problem here is that I'm unable to find the appropriate code to generate the Array of user's ids
Quote:
$item['itemId']['ownerId']
For testing, I replaced it with a user id '6' and it worked but now how do I find the Array of all user's ids associated with the searched items? I know that you can find the user's id in the tpl with this code
Quote:
{$SearchScan.items.$itemId.ownerId}
but how to call it in the SearchScan.inc?
Your help is much appreciated Thanks!
Gallery version = 2.2.6 core 1.2.0.8
PHP version = 5.2.14 cgi-fcgi
Webserver = Apache
Database = mysqli 5.1.47-community-log, lock.system=flock
Toolkits = ArchiveUpload, Gd, NetPBM, Getid3, Thumbnail, Ffmpeg, Dcraw, Exif
Acceleration = partial/900, partial/900
Default theme = matrix
gettext = enabled
Locale = en_US
Posts: 1642
$item->getOwnerId();
--
dakanji.com
Posts: 3
Tried here:
Got this error:
Posts: 1642
The error means you don't have an Item object there.
I didn't look at the preceding code for validity and just gave you the answer to how to get the Owner Id in the inc file. Which is to call the getOwnerId method of an Item.
You need to have the Item in place in the first place.
--
dakanji.com
Posts: 3
Solved! Thanks!
For those who are wondering how I did it. Here's the code I put in SearchScan.inc
Call it in SearchScan.tpl:
Posts: 71
when i click advanced search it give me error
Posts: 8339
you should really perform a module availability check:
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2