diff --git a/ajax/frontend/profile/getProfileBarCategories.php b/ajax/frontend/profile/getProfileBarCategories.php index 68ca283421fdc85504b06ba269147b3ca7744177..586fa5b568b93e7f04acbdae2b14806c69cbc703 100644 --- a/ajax/frontend/profile/getProfileBarCategories.php +++ b/ajax/frontend/profile/getProfileBarCategories.php @@ -32,26 +32,30 @@ function () { $categories = utils::setUrlsToCategorySettings($categories); // Check if "go to profile" button is added - try { - $profileBarSettings = Handler::getInstance()->getProfileBarSettings(); - - if (!empty($profileBarSettings['showToProfile']) && !empty($categories['user'])) { - \array_unshift($categories['user']['items'], [ - 'name' => 'toprofile', - 'title' => QUI::getLocale()->get( - 'quiqqer/frontend-users', - 'profilebar.to_profile' - ), - 'index' => 0, - 'icon' => 'fa fa-user', - 'control' => false, - 'showinprofilebar' => true, - 'content' => false, - 'url' => $ProfileSite->getUrlRewritten() - ]); + $User = QUI::getUserBySession(); + + if (QUI::getUsers()->isUser($User) && !($User instanceof QUI\Users\Nobody)) { + try { + $profileBarSettings = Handler::getInstance()->getProfileBarSettings(); + + if (!empty($profileBarSettings['showToProfile']) && !empty($categories['user'])) { + \array_unshift($categories['user']['items'], [ + 'name' => 'toprofile', + 'title' => QUI::getLocale()->get( + 'quiqqer/frontend-users', + 'profilebar.to_profile' + ), + 'index' => 0, + 'icon' => 'fa fa-user', + 'control' => false, + 'showinprofilebar' => true, + 'content' => false, + 'url' => $ProfileSite->getUrlRewritten() + ]); + } + } catch (\Exception $Exception) { + QUI\System\Log::writeException($Exception); } - } catch (\Exception $Exception) { - QUI\System\Log::writeException($Exception); } return $categories;