- 'label' => t('Events'),
- 'url' => App::get_baseurl() . '/cal/' . $nickname,
- 'sel' =>((!isset($tab) && $a->argv[0]=='cal') ? 'active' : ''),
- 'title' => t('Events and Calendar'),
- 'id' => 'events-tab',
- 'accesskey' => 'e',
- );
+ 'label' => t('Events'),
+ 'url' => System::baseUrl() . '/events',
+ 'sel' => !$tab && $a->argv[0] == 'events' ? 'active' : '',
+ 'title' => t('Events and Calendar'),
+ 'id' => 'events-tab',
+ 'accesskey' => 'e',
+ );
+ // 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[] = array(
+ 'label' => t('Events'),
+ 'url' => System::baseUrl() . '/cal/' . $nickname,
+ 'sel' => !$tab && $a->argv[0] == 'cal' ? 'active' : '',
+ 'title' => t('Events and Calendar'),
+ 'id' => 'events-tab',
+ 'accesskey' => 'e',
+ );