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

Please note: The Kunena project team takes NO responsibility for maintaining nor supporting anything in this category.

Loved Subscribe button on front page

More
10 years 8 months ago - 10 years 8 months ago #1 by MusicInMe
Well, hope I get help because this is getting on top of me. I added Subscribe button on the front page to allow user do this without open category where this button is usualy placed.
Code:
<?php if ($this->category->authorise ( 'subscribe', null, true )) : $subscribed = $this->category->getSubscribed($this->me->userid); if (!$subscribed) { ?> <a class="hasTooltip" href="index.php?option=com_kunena&view=category&task=subscribe&catid=<?php echo $category->id; ?><?php echo $token; ?>" title="<?php echo JText::_('COM_KUNENA_TEMPLATE_SUBSCRIBE_NOW'); ?>" > <button class="btn btn-warning btn-small"> <i class="icon-white icon-envelope"></i> </button> </a> <?php }; ?> <?php else: ?> <a class="hasTooltip" href="index.php?option=com_kunena&view=category&task=unsubscribe&catid=<?php echo $category->id; ?><?php echo $token; ?>" title="<?php echo JText::_('COM_KUNENA_TEMPLATE_UNSUBSCRIBE'); ?>"> <button class="btn btn-warning btn-small"> <i class="icon-white icon-envelope"></i> </button> </a> <?php endif; ?>

This only show second option, as every category is already subscribed. At the beginning of file I placed
Code:
$token = '&' . JSession::getFormToken() . '=1';

but it doesn't help to identify user is alowed to su/unsubscribe. When I enter to category I am able to subscribe to any childforum this category contain. So need to figure out only front page.
Last edit: 10 years 8 months ago by MusicInMe.

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

More
10 years 8 months ago #2 by xillibit

MusicInMe wrote:
This only show second option, as every category is already subscribed. At the beginning of file I placed

Code:
$token = '&' . JSession::getFormToken() . '=1';

but it doesn't help to identify user is alowed to su/unsubscribe. When I enter to category I am able to subscribe to any childforum this category contain. So need to figure out only front page.

Hello,

The JSession::getFormToken() just set a token to avoid security problems.

To get the user id you can use by example :
Code:
JFactory::getUser()->id;

I don't provide support by PM, because this can be useful for someone else.

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

More
10 years 8 months ago #3 by MusicInMe
Wasn't easy but finaly got the solution:
Added code (just after
Code:
defined ( '_JEXEC' ) or die ();
at the top of let say in template/my_template/html/category/default.php
Code:
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}"; $substitle = "Subscribe"; $tiptile = "Subscribe to category"; } else { $subscription = "index.php?option=com_kunena&view=category&task=unsubscribe&catid={$this->category->id}{$token}"; $substitle = "Unubscribe"; $tiptitle = "Unsubscribe from category"; } }

and then, where the code must be shown
Code:
<a href="<?php echo $subscription; ?>" class="hasTooltip" title="<?php echo $tiptitle; ?>"><i class="icon-envelope"></i> <?php echo $substitle; ?></a>

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

Time to create page: 0.445 seconds