Collection tree permissions related error

We are using 2.0.4, the Berlin theme, and in the public viewable is showing an error in the collections under the collection tree --
Notice: Undefined index: id in /var/www/html/omeka/plugins/CollectionTree/views/helpers/CollectionTreeList.php on line 35

This does not occur for those of us who are editing and logged it.

Has anyone experience this error or have any ideas of what we could do to make it disappear?

Thank you!

Jeannine

My guess is that it is being caused by a parent collection being private, and the plugin isn't handling that situation when it tries to display the tree. At least that's what I did to reproduce the problem.

If that's the case, then the following change _might_ work -- I haven't extensively tested it yet on a site with lots of collections and trees with some private and some public. But for now, it's worth a shot, and feedback will help us a lot!

In the file plugins/CollectionTree/views/helpers/CollectionTreeList.php look for this block of code:

foreach ($collectionTree as $collection) {
            $html .= '<li>';
            if ($linkToCollectionShow && !isset($collection['current'])) {
                $html .= link_to_collection(null, array(), 'show', $collectionTable->find($collection['id']));
            } else {
                $html .= $collection['name'] ? $collection['name'] : '[Untitled]';
            }
            $html .= $this->collectionTreeList($collection['children'], $linkToCollectionShow);
            $html .= '</li>';
        }

and replace it with

foreach ($collectionTree as $collection) {
            if(isset($collection['id'])) {
                $html .= '<li>';
                if ($linkToCollectionShow && !isset($collection['current'])) {
                    $html .= link_to_collection(null, array(), 'show', $collectionTable->find($collection['id']));
                } else {
                    $html .= $collection['name'] ? $collection['name'] : '[Untitled]';
                }
            }
            $html .= $this->collectionTreeList($collection['children'], $linkToCollectionShow);
            $html .= '</li>';
        }

It's possible that for more complex collection trees than what I have, the styling in the display could come out wonky, but this might at least be a start. Feedback on whether this breaks other pages will help us find something better.

That was exactly it and the code worked! Thank you!

Great! I discovered that if you have a tree like public -> private -> public, the private one breaks the chain. Not sure if that is a case that is likely to come up.