/** * Prepare message actions display. * * @return void */ protected function before() { parent::before(); $catid = $this->input->getInt('id'); $me = KunenaUserHelper::getMyself(); $this->category = KunenaForumCategory::getInstance($catid); $token = JSession::getFormToken(); $task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1"; $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}"; $this->template = KunenaFactory::getTemplate(); $this->categoryButtons = new JObject(); // Is user allowed to post new topic? if ($this->category->getNewTopicCategory()->exists()) { $this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true)); } // Is user allowed to mark forums as read? if ($me->exists()) { $this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true)); } // Is user allowed to subscribe category? if ($this->category->isAuthorised('subscribe')) { $subscribed = $this->category->getSubscribed($me->userid); if (!$subscribed) { $this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true)); } else { $this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true)); } } JPluginHelper::importPlugin('kunena'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this)); }