- // if the user is not the owner of the calendar we only show a calendar
- // with the public events of the calendar owner
- } elseif (!$is_owner) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Calendar'),
- 'url' => DI::baseUrl() . '/calendar/show/' . $nickname,
- 'sel' => $current == 'calendar' ? 'active' : '',
- 'title' => DI::l10n()->t('Calendar'),
- 'id' => 'calendar-tab',
- 'accesskey' => 'c',
- ];
+ } else {
+ $owner = User::getByNickname($nickname, ['uid']);
+ if(DI::userSession()->isAuthenticated() || $owner && Feature::isEnabled($owner['uid'], 'public_calendar')) {
+ $tabs[] = [
+ 'label' => DI::l10n()->t('Calendar'),
+ 'url' => DI::baseUrl() . '/calendar/show/' . $nickname,
+ 'sel' => $current == 'calendar' ? 'active' : '',
+ 'title' => DI::l10n()->t('Calendar'),
+ 'id' => 'calendar-tab',
+ 'accesskey' => 'c',
+ ];
+ }