From c61a62574c0778a2faaed4af66f7d6ddd2c49f8d Mon Sep 17 00:00:00 2001 From: hukoeth Date: Fri, 24 Sep 2010 19:10:16 +0800 Subject: [PATCH] Fixed bug where user profile page would display empty thumbs for items not viewable by logged in user --- modules/photoannotation/helpers/photoannotation_event.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/photoannotation/helpers/photoannotation_event.php b/modules/photoannotation/helpers/photoannotation_event.php index 1db486b8..756389d6 100644 --- a/modules/photoannotation/helpers/photoannotation_event.php +++ b/modules/photoannotation/helpers/photoannotation_event.php @@ -150,15 +150,17 @@ class photoannotation_event_Core { $view = new Theme_View("dynamic.html", "collection", "userprofiles"); //load thumbs $item_users = ORM::factory("items_user")->where("user_id", "=", $data->user->id)->find_all(); - $children_count = count($item_users); foreach ($item_users as $item_user) { $item_thumb = ORM::factory("item") ->viewable() ->where("type", "!=", "album") ->where("id", "=", $item_user->item_id) ->find(); - $item_thumbs[] = $item_thumb; + if ($item_thumb->loaded()) { + $item_thumbs[] = $item_thumb; + } } + $children_count = count($item_thumbs); $page_size = module::get_var("gallery", "page_size", 9); $page = (int) Input::instance()->get("page", "1"); $offset = ($page-1) * $page_size;