Kunena 6.3.0 released

The Kunena team has announce the arrival of Kunena 6.3.0 [K 6.3.0] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 and issues discovered during the last development stages of K 6.3

Topics that are moved into this category are generally considered to be closed. Users may want to add additional information but these topics should not be resurrected in order to discuss new problems or unrelated matters.

Solved Drop down menu custom links in topic view

More
10 years 8 months ago - 10 years 8 months ago #1 by MusicInMe
Hello,

Below code works perfect with drop down menu in topics list (category layout)
Code:
if ($this->me->exists()) { $token = '&' . JSession::getFormToken() . '=1'; $markread = "index.php?option=com_kunena&view=category&task=markread&catid={$this->section->id}{$token}"; } if ($this->category->authorise ( 'subscribe', null, true )) { $subscribed = $this->category->getSubscribed($this->me->userid); if (!$subscribed) { $subscription = "index.php?option=com_kunena&view=category&task=subscribe&catid={$this->category->id}{$token}"; $subtitle = "Subscribe"; $subtiptile = "Subscribe to category"; } else { $subscription = "index.php?option=com_kunena&view=category&task=unsubscribe&catid={$this->category->id}{$token}"; $subtitle = "Unubscribe"; $subtiptile = "Unsubscribe from this category"; } } ----------- <ul class="dropdown-menu"> <li> <a href="<?php echo $newtopic; ?>" class="hasTooltip" title="Create a new topic"><i class="icon-pencil"></i> New Topic</a> <a href="<?php echo $markread; ?>" class="hasTooltip" title="Mark all topics in this categeory as read"><i class="icon-check"></i> Mark Topics Read</a> <a href="<?php echo $subscription; ?>" class="hasTooltip" title="<?php echo $subtiptile; ?>"><i class="icon-envelope"></i> <?php echo $subtitle; ?></a> </li> </ul>

But when I adjust it to topic view (insted of topic buttons)
Code:
if ($this->topic->authorise ( 'subscribe', null, true )) { $subscribed = $this->topic->getUserTopic($this->me->userid); if (!$subscribed) { $subscription = "index.php?option=com_kunena&view=topic&task=subscribe&catid={$this->category->id}{$token}"; $subtitle = "Subscribe"; $subtiptitle = "Subscribe to this topic"; } else { $subscription = "index.php?option=com_kunena&view=topic&task=unsubscribe&catid={$this->category->id}{$token}"; $subtitle = "Unubscribe"; $subtiptitle = "Unsubscribe from this topic"; } } if ($this->usertopic->favorite) { $favorited = $this->topic->getUserTopic($this->me->userid); if (!$favorited) { $favorites = "index.php?option=com_kunena&view=topic&task=favorite&catid={$this->category->id}{$token}"; $favtitle = "Favorite"; $favtiptitle = "Favorite this topic"; } elseif ($this->topic->authorise('subscribe')) { $favorites = "index.php?option=com_kunena&view=topic&task=unfavorite&catid={$this->category->id}{$token}"; $favtitle = "Unfavorite"; $favtiptitle = "Remove this topic from favorites"; } }
and trying to unsubscribe I get error

This topic has NOT been removed from your subscriptions. You do not have permissions to access this page.


I have tried many combinations, but none of them work properly. Oddly enough token is correct because I checked it with the URL of normal button.
Any suggestions for a URL to subscribe to topic or to add it to favorites?
Last edit: 10 years 8 months ago by MusicInMe.
The following user(s) said Thank You: dirkovision

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago #2 by MusicInMe
Once again, after few hours of diggin in Kunena files, I figured it out :)
Code:
$catid = $this->state->get('item.catid'); $id = $this->state->get('item.id'); $topic = $this->mesid; if ($this->topic->authorise('subscribe')) { $subscribed = ($this->usertopic->subscribed) && $this->me->exists(); if (!$subscribed) { $subscription = "index.php?option=com_kunena&view=topic&task=subscribe&catid={$catid}&id={$id}{$token}&itemid={$itemid}"; $subtitle = "Subscribe"; $subtiptile = "Subscribe to category"; } else { $subscription = "index.php?option=com_kunena&view=topic&task=unsubscribe&catid={$catid}&id={$id}{$token}&itemid={$itemid}"; $subtitle = "Unubscribe"; $subtiptile = "Unsubscribe from this category"; } } if ($this->topic->authorise('favorite')) { $favorited = ($this->usertopic->favorite) && $this->me->exists(); if (!$favorited) { $favorites = "index.php?option=com_kunena&view=topic&task=favorite&catid={$catid}&id={$id}{$token}&itemid={$itemid}"; $favtitle = "Favorite"; $favtiptitle = "Favorite this topic"; } else { $favorites = "index.php?option=com_kunena&view=topic&task=unfavorite&catid={$catid}&id={$id}{$token}&itemid={$itemid}"; $favtitle = "Unfavorite"; $favtiptitle = "Remove this topic from favorites"; } } __________________________________________ <ul class="dropdown-menu"> <li> <a href="<?php echo $subscription; ?>" class="hasTooltip" title="<?php echo $subtiptile; ?>"><i class="icon-envelope"></i> <?php echo $subtitle; ?></a> <a href="<?php echo $favorites; ?>" class="hasTooltip" title="<?php echo $favtiptile; ?>"><i class="icon-envelope"></i> <?php echo $favtitle; ?></a> </li> </ul>
The following user(s) said Thank You: dirkovision

Please Log in or Create an account to join the conversation.

Time to create page: 0.478 seconds