From 8335d234f7b8e75a1ecd3bd8a072effe6afd0fb3 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 8 Apr 2011 13:56:08 -0700 Subject: [PATCH] Don't try to show search and tag subs unless a user is logged in --- plugins/SearchSub/SearchSubPlugin.php | 10 ++++++---- plugins/TagSub/TagSubPlugin.php | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/SearchSub/SearchSubPlugin.php b/plugins/SearchSub/SearchSubPlugin.php index 813b8290d8..785c8fe006 100644 --- a/plugins/SearchSub/SearchSubPlugin.php +++ b/plugins/SearchSub/SearchSubPlugin.php @@ -324,11 +324,13 @@ class SearchSubPlugin extends Plugin { $user = common_current_user(); - $searches = SearchSub::forProfile($user->getProfile()); + if (!empty($user)) { + $searches = SearchSub::forProfile($user->getProfile()); - if (!empty($searches) && count($searches) > 0) { - $searchSubMenu = new SearchSubMenu($menu->out, $user, $searches); - $menu->submenu(_m('Searches'), $searchSubMenu); + if (!empty($searches) && count($searches) > 0) { + $searchSubMenu = new SearchSubMenu($menu->out, $user, $searches); + $menu->submenu(_m('Searches'), $searchSubMenu); + } } return true; diff --git a/plugins/TagSub/TagSubPlugin.php b/plugins/TagSub/TagSubPlugin.php index a9b24b0b59..ba1cff6673 100644 --- a/plugins/TagSub/TagSubPlugin.php +++ b/plugins/TagSub/TagSubPlugin.php @@ -245,11 +245,14 @@ class TagSubPlugin extends Plugin { $user = common_current_user(); - $tags = TagSub::forProfile($user->getProfile()); + if (!empty($user)) { - if (!empty($tags) && count($tags) > 0) { - $tagSubMenu = new TagSubMenu($menu->out, $user, $tags); - $menu->submenu(_m('Tags'), $tagSubMenu); + $tags = TagSub::forProfile($user->getProfile()); + + if (!empty($tags) && count($tags) > 0) { + $tagSubMenu = new TagSubMenu($menu->out, $user, $tags); + $menu->submenu(_m('Tags'), $tagSubMenu); + } } return true;