Don't try to show search and tag subs unless a user is logged in

This commit is contained in:
Zach Copley 2011-04-08 13:56:08 -07:00
parent ea82086297
commit 8335d234f7
2 changed files with 13 additions and 8 deletions

View File

@ -324,11 +324,13 @@ class SearchSubPlugin extends Plugin
{ {
$user = common_current_user(); $user = common_current_user();
$searches = SearchSub::forProfile($user->getProfile()); if (!empty($user)) {
$searches = SearchSub::forProfile($user->getProfile());
if (!empty($searches) && count($searches) > 0) { if (!empty($searches) && count($searches) > 0) {
$searchSubMenu = new SearchSubMenu($menu->out, $user, $searches); $searchSubMenu = new SearchSubMenu($menu->out, $user, $searches);
$menu->submenu(_m('Searches'), $searchSubMenu); $menu->submenu(_m('Searches'), $searchSubMenu);
}
} }
return true; return true;

View File

@ -245,11 +245,14 @@ class TagSubPlugin extends Plugin
{ {
$user = common_current_user(); $user = common_current_user();
$tags = TagSub::forProfile($user->getProfile()); if (!empty($user)) {
if (!empty($tags) && count($tags) > 0) { $tags = TagSub::forProfile($user->getProfile());
$tagSubMenu = new TagSubMenu($menu->out, $user, $tags);
$menu->submenu(_m('Tags'), $tagSubMenu); if (!empty($tags) && count($tags) > 0) {
$tagSubMenu = new TagSubMenu($menu->out, $user, $tags);
$menu->submenu(_m('Tags'), $tagSubMenu);
}
} }
return true; return true;