Kunena 7.0.6 & Kunena 6.4.12 – Security Updates Released

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

The Kunena team is also pleased to announce the twelfth version of Kunena 6.4, a native Joomla extension for Joomla! 5.0, 5.1, 5.2, 5.3, 5.4 and 6.0.

This category contains miscellaneous, uncategorised user contributions, (templates, modules, plugins and hacks) relating to older versions of Kunena that are no longer supported.

The topics in this category are for historical interest only. Owing to the structural changes that occurred in K 1.7, many of the ideas in these topics will not work with later versions and, for that reason, the topics are locked.

Question Kunena Hide Tags Hack Force Reply To View Hidden Content

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Only the strongest will survive
More
14 years 6 months ago - 14 years 5 months ago #112307 by C0n
So I spent the last couple of days working on this one, I started out with a few mysql quiries and a major head ache of how I was going to check if a user had replied to the current topic/thread, After playing about writing up a few diffrent mysql quiries I finaly got it. (I feel so proud of myself B) )

What the hide hack does is for users who create post's on the forum using "Hide Tags" it quiries if they have replied or not to the topic yet before it grants them access to view the hidden content. (Brilliant little feature against leechers and content scrappers.), This shall also allow users to know what members are gaining access to the content they provide on the forum hence the fact other members have to reply to the topic to view the content.
Code:
[hide][/hide]

This feature is being used in forums such as vBulletin, PHPBB, SMF, IPBoard and MyBB. But now it can also be featured in Kunena too :woohoo: !!

Feature list :
  • Force reply to view hidden content of posts in a topic
  • Choose to either reply to topic or click the Thanks button
  • Set user post count requirement to view hidden contents. (
    Part of the message is hidden for the guests. Please log in or register to see it.

It is very small and simple only one file needs to be edited.

site/components/com_kunena/lib/kunena.praser.php
kunena.praser.php (Lines : 1059 - 1074)
Code:
if ($kunena_my->id == 0) { // Hide between content from non registered users $tag_new = JText::_('COM_KUNENA_BBCODE_HIDDENTEXT'); } else { $user =& JFactory::getUser(); $usr_id = $user->get('id'); $lol = JRequest::getVar('id'); $database = &JFactory::getDbo(); $database->setQuery("SELECT thread FROM #__kunena_messages WHERE userid='$usr_id' AND thread='$lol'", 0, 1); $threads = $database->loadResult(); if (CKunenaTools::isAdmin () || (CKunenaTools::isModerator ( $this->my->id ))) { $tag_new = '<b>' . JText::_('COM_KUNENA_BBCODE_HIDE_IN_MESSAGE') . '</b>' . '<div class="kmsgtext-hide">' . $between . '</div>'; } else { if ( $threads == $lol ) { $tag_new = '<b>' . JText::_('COM_KUNENA_BBCODE_HIDE_IN_MESSAGE') . '</b>' . '<div class="kmsgtext-hide">' . $between . '</div>'; } else { $tag_new = JText::_('You must reply to view the hidden content here'); } } // Display but highlight the fact that it is hidden from guests }

For those who are to lazy to locate the code just overwrite your kunena.praser.php at the following location site/components/com_kunena/lib/kunena.praser.php
(Extract the praser.php from the zip archive)

This file is for The force reply hack only :

File Attachment:

File Name: kunena.parser.zip
File Size:14.5 KB


This file contains all Features Force Reply, Click Thanks button hack feature, Set post count (
Part of the message is hidden for the guests. Please log in or register to see it.
Last edit: 14 years 5 months ago by C0n.
The following user(s) said Thank You: radioactive, Surrealer

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

More
14 years 6 months ago - 14 years 6 months ago #112312 by ChaosHead
Thanks, good work. Very useful Hack.
Last edit: 14 years 6 months ago by ChaosHead.

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

More
14 years 6 months ago #112417 by Matias
Just remember that making SQL query like this can be slow if there are a lot of messages in the topic.

@C0n

FYI: you should probably use static variable to cache the results as the query only needs to be run once. There's also better way to get current topic (parser is used also for categories, announcements and others), $this->parent contains a lot of useful information (just remember that it can be NULL!)
The following user(s) said Thank You: C0n

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

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Only the strongest will survive
More
14 years 6 months ago #112434 by C0n
Yeah i relized it would proborly be bad running quiries like this, But if you compare my code what is one line for a SQL query compared to the Hide hack's for other forums they use a ton of code just to achieve it.

Also i think the user object was also already loaded in the praser.php

But thanks for the advice Matias i will study kunena a bit more and work on ways to improve this.

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

More
14 years 6 months ago #113178 by radioactive
I Tried this :huh: :huh: it didn't work at all :-|

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

More
14 years 6 months ago #113204 by Matias
One optimization suggestion:

Can you limit the SQL query to return only the first value:

$database->setQuery("SELECT thread FROM #__kunena_messages WHERE userid='$usr_id' AND thread='$lol'", 0, 1);

Makes it to run a bit faster on large topics. ;)
The following user(s) said Thank You: C0n

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

Time to create page: 0.279 seconds