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.

Question Kunena Hide tags Hack Force Reply / Thanks to view hidden content

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Only the strongest will survive
More
9 years 1 month ago - 9 years 1 month ago #1 by C0n
So i wrote this up for Kunena 1.6 / 7 About 3-4 years ago but decided to start adding it back into my own forum and decided i will share with you all so be greatfull. B)

Original old outdated version is here : www.kunena.org/forum/k-1-6-and-k-1-7-mis...-view-hidden-content

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 / give thanks to the topic or post to view the content.
Code:
[hide][/hide] [hide=100][/hide]

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.

I am still getting to grips with the changes in Kunena's Code but this is the working version so far.

\public_html\libraries\kunena\bbcode\bbcode.php (Lines : 1006 function dohide)
Code:
function DoHide($bbcode, $action, $name, $default, $params, $content) { if ($action == BBCODE_CHECK) return true; if (!empty($bbcode->lost_start_tags[$name]) && !$bbcode->was_limited) { return "[{$name}]{$content}"; } // Display nothing in activity streams etc.. if (!empty($bbcode->parent->forceSecure)) { return; } if (JFactory::getUser ()->id == 0) { // Hide between content from non registered users return '</br>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDDENTEXT' ); } else { $user =& JFactory::getUser(); $usr_id = $user->get('id'); $lol = JRequest::getVar('id'); $database = &JFactory::getDbo(); $maxpost = 100; $database->setQuery("SELECT thread FROM #__kunena_messages WHERE userid='$usr_id' AND thread='$lol'", 0, 1); $threads = $database->loadResult(); $database->setQuery("SELECT postid FROM #__kunena_thankyou WHERE userid='$usr_id' AND postid='$lol'", 0, 1); $thankyou = $database->loadResult(); $database->setQuery("SELECT posts FROM #__kunena_users WHERE userid='$usr_id'"); $posts = (int)$database->loadResult(); $me = KunenaUserHelper::getMyself(); if (($me->userid && $bbcode->parent->message->userid == $me->userid) || $me->isModerator(isset($bbcode->parent->message) ? $bbcode->parent->message->getCategory() : null)) { return '</br><b>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDE_IN_MESSAGE' ) . '</b>' . '<div class="kmsgtext-hide">' . $content . '</div>'; } else { /* if (isset (['default'])) { $tempstr = ['default']; if ($tempstr > $maxpost) $tempstr = $maxpost; if ( $posts >= $tempstr ) { return '</br><b>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDE_IN_MESSAGE' ) . '</b>' . '<div class="kmsgtext-hide">' . $content . '</div>'; } else { return '</br><b>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDE_IN_MESSAGE' ) . '</b>' . '<div class="kmsgtext-hide">You require ' . $tempstr . ' posts in order to view the content contained Here.</div>'; } } else { */ if ( $threads == $lol || $thankyou == $lol ) { return '</br><b>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDE_IN_MESSAGE' ) . '</b>' . '<div class="kmsgtext-hide">' . $content . '</div>'; } else { return '</br><b>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDE_IN_MESSAGE' ) . '</b>' . '<div class="kmsgtext-hide">You Must Reply to this topic or give Thanks in order to view the content contained Here.</div>'; } } } // Display but highlight the fact that it is hidden from guests //return '</br><b>' . JText::_ ( 'COM_KUNENA_BBCODE_HIDE_IN_MESSAGE' ) . '</b>' . '<div class="kmsgtext-hide">' . $content . '</div>'; //} }

The reason i currently have a section of code nulled out is because i am still trying to get the hide for post count feature to work. Just like i did with the previous kunena, I am sure i will get my head around it soon.

Current Bug's / Issues :
  1. BBcode on hide hack for post count requirement
    Code:
    [hide=100]
    does not seem to want to work.

  2. Kunena Caching posts, Prevents user from viewing content they just replied / gave thanks to until cache expires. (Need to find a way around this without disabling caches.)

Perhaps a Kunena Dev can tell me what the equivalant for new kunena from the previous BBCode to detect if a code tag had a string attached.
In the old version
Code:
if (isset ( $tag->options ['default'] )) {

Slowly figuring it out.
Code:
'hide' => array( 'mode' => BBCODE_MODE_LIBRARY, 'method' => 'DoHide', 'allow' => array('_default' => '/^\d*$/'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns'), 'content' => BBCODE_REQUIRED, 'plain_content' => array(), ),
Last edit: 9 years 1 month ago by C0n.

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

Time to create page: 0.660 seconds