]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't try to show search and tag subs unless a user is logged in
authorZach Copley <zach@status.net>
Fri, 8 Apr 2011 20:56:08 +0000 (13:56 -0700)
committerZach Copley <zach@status.net>
Fri, 8 Apr 2011 20:56:08 +0000 (13:56 -0700)
plugins/SearchSub/SearchSubPlugin.php
plugins/TagSub/TagSubPlugin.php

index 813b8290d8fff996735d1d280a78a3017b852de5..785c8fe00622eec13f9746f75c60eeec0a7811d8 100644 (file)
@@ -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;
index a9b24b0b5941d20ec0882699a38c2efc9545b033..ba1cff6673a0fb7ea580453ed9beeec1f76bd7d2 100644 (file)
@@ -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;