Strange behavior on exhibits

Hi, I am trying to get an illustration for Exhibit

$page = $pages[0];
$data = exhibit_builder_page_attachment(1,0,$page);
if($data['file']) {
$img_url = file_display_url($data['file']);
}

When I'm not logged as administrator, I am unable to get $img_url.

Now, going down in exhibit_builder_page_attachment() method

function exhibit_builder_page_attachment($entryIndex = 1, $fallbackFileIndex = 0, $exhibitPage = null)
{
if (!$exhibitPage) {
$exhibitPage = get_current_record('exhibit_page');
}

$entries = $exhibitPage->ExhibitPageEntry;

if (!isset($entries[$entryIndex])) {
return null;
}

$entry = $entries[$entryIndex];

$item = null;
$file = null;
$file_specified = false;
$caption = null;

if (($item = $entry->Item)) {
if (($file = $entry->File)) {
$file_specified = true;
} else if (isset($item->Files[$fallbackFileIndex])) {
$file = $item->Files[$fallbackFileIndex];
}
} else {
// If there's no item, nothing is attached.
return null;
}

$caption = $entry->caption;

return compact(array('item', 'file', 'file_specified', 'caption'));
}

In exhibitPageFunction.php

I found that I am able to retrieve

$entry = $entries[$entryIndex];

But $entry->Item and $entry->File return NULL when I'm not logged as administrator, very strange ?

Any Idea

The most common cause for that is the Item not being set to public. Maybe double-check that.

In ExhibitBuilder 3, I am not finding the function exhibit_builder_page_attachment. Is there another way to get a list of pages and the first attachment (image) associated with that page? One of our exhibits features images with each exhibit page link on the exhibit home page. I'd appreciate your assistance on bringing that back when using version 3.

The new record_image() function available throughout Omeka works for a single Exhibit, but it doesn't look like it works for individual pages. The entire system is a bit different, since in EB3 items are attached to blocks within pages, not directly to pages.

The getFile() method in models/Exhibit.php might give inspiration for the kind of code that could get at what you are looking for.

If you have more questions, it'll be best to start a new thread, just so we can keep better track of conversations.