Skip to content
Code-Schnipsel Gruppen Projekte

fix: user validation before displaying profile bar items

Zusammengeführt Henning Leutz requested to merge next-2.x into main
1 Datei
+ 25
19
Änderungen vergleichen
  • Nebeneinander
  • In der Reihe
@@ -13,6 +13,7 @@
'package_quiqqer_frontend-users_ajax_frontend_profile_getProfileBarCategories',
function () {
$ProfileSite = Handler::getInstance()->getProfileSite();
$User = QUI::getUserBySession();
if (!$ProfileSite) {
return [];
@@ -32,26 +33,31 @@ 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()
]);
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;
Lade