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

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
  • Only the strongest will survive
More
12 years 4 months ago - 12 years 3 months ago #1 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:15 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.
Attachments:
Last edit: 12 years 3 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
12 years 4 months ago - 12 years 4 months ago #2 by ChaosHead
Thanks, good work. Very useful Hack.
Last edit: 12 years 4 months ago by ChaosHead.

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

More
12 years 4 months ago #3 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
  • Only the strongest will survive
More
12 years 4 months ago #4 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
12 years 4 months ago #5 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
12 years 4 months ago #6 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.

More
12 years 4 months ago #7 by radioactive
matias bro ..is this possible ? i tried it ..and the hack din't work for me

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

More
12 years 4 months ago #8 by Matias
I've not tested it, but it looks like it should work. Talk with C0n ;)

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

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Only the strongest will survive
More
12 years 4 months ago - 12 years 4 months ago #9 by C0n
Make sure your editing the correct file do you have the ability to find the line numbers ?

Code:
if ($kunena_my->id == 0) { // Hide between content from non registered users $tag_new = JText::_('COM_KUNENA_BBCODE_HIDDENTEXT'); } else {

Make sure that is what your looking at before you edit / overwrite the code.

Also if you doubt it's ability to work it's live on one of my sites.

Part of the message is hidden for the guests. Please log in or register to see it.


Matias i added your snippet to the original post replacing the old MySQL query :D very nice.

I've uploaded a kunena.praser.php aswell so users who are doing something wrong can just overwrite the old file to save them searching through lines of code.
Last edit: 12 years 4 months ago by C0n.

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

More
12 years 4 months ago #10 by yuzef
The code is working.
But i see in your attachment zip file on line 1057 its lost one character "i" before "f" = its must be " if "

Love Simplicty
read...... and learn........

My Joomla Test Site

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

Time to create page: 0.557 seconds