Kunena 6.4.8 Released

The Kunena team has announce the arrival of Kunena 6.4.8 [K 6.4.8] in stable which is now available for download as a native Joomla extension for J! 5.0.x/5.1.x/5.2.x/5.3.x/5.4.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 6.4
Important note: Go to the Kunena Dashboard after an upgrade so that the Kunena database tables are also updated. This is particularly necessary for major version jumps so that the table changes are adapted.

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 Forum Categories/Sections Post Count Restriction

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Only the strongest will survive
More
14 years 2 months ago - 14 years 2 months ago #111186 by C0n
So the title say's it all if you want to stop a user with a post count lower than "10" for example posting in specific section's of the forum then this is how you do it.



Now when your in the back end of your site looking at the categories manager you notice how every forum categorie has it's own ID, For example "General Discussion" has the ID of "2".
In the following line's of code where it says :
Code:
if ( $check == "2" || $check == "3" || $check == "4" || $check == "5" ) {
Just replace the ID number's with what ever the ID's of your forum categories you wish to block.

Add the following lines of code to the file paths of your Kunena forum.
components/com_kunena/funcs/showcat.php Line 172 :
Code:
if (CKunenaTools::isModerator ( $this->my->id, $this->catid ) || !$this->kunena_forum_locked) { $check = JRequest::getVar('catid'); $user =& JFactory::getUser(); $usr_id = $user->get('id'); $database = &JFactory::getDbo(); $database->setQuery("SELECT posts FROM #__kunena_users WHERE userid='$usr_id'"); $posts = (int)$database->loadResult(); if ( $check == "2" || $check == "3" || $check == "4" || $check == "5" ) { if ( $posts >= "10" ) { $this->forum_new = CKunenaLink::GetPostNewTopicLink ( $this->catid, CKunenaTools::showButton ( 'newtopic', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC') ), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC_LONG') ); } } else { $this->forum_new = CKunenaLink::GetPostNewTopicLink ( $this->catid, CKunenaTools::showButton ( 'newtopic', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC') ), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC_LONG') ); } }

components/com_kunena/template/defualt/view/view.php (Be easyer just to replace the content of the entire file with the following.)
Code:
<?php // Dont allow direct linking defined( '_JEXEC' ) or die(); $user =& JFactory::getUser(); $check = JRequest::getVar('catid'); $usr_id = $user->get('id'); $database = &JFactory::getDbo(); $database->setQuery("SELECT posts FROM #__kunena_users WHERE userid='$usr_id'"); $posts = (int)$database->loadResult(); $document = JFactory::getDocument (); $document->addScriptDeclaration('// <![CDATA[ var kunena_anonymous_name = "'.JText::_('COM_KUNENA_USERNAME_ANONYMOUS').'"; // ]]>'); ?> <div><?php $this->displayPathway(); ?></div> <?php if($check == "2" || $check == "3" || $check == "4" || $check == "5"): ?> <?php if($posts >= "10"): ?> <?php if ($this->headerdesc) : ?> <div id="kforum-head" class="<?php echo isset ( $this->catinfo->class_sfx ) ? ' kforum-headerdesc' . $this->escape($this->catinfo->class_sfx) : '' ?>"> <?php echo $this->headerdesc ?> </div> <?php endif ?> <?php $this->displayPoll(); CKunenaTools::showModulePosition( 'kunena_poll' ); $this->displayThreadActions(0); ?> <div class="kblock"> <div class="kheader"> <h2><span><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->kunena_topic_title) ?></span></h2> <?php if ($this->favorited) : ?><div class="kfavorite"></div><?php endif ?> </div> <div class="kcontainer"> <div class="kbody"> <?php foreach ( $this->messages as $message ) $this->displayMessage($message) ?> </div> </div> </div> <?php $this->displayThreadActions(1); ?> <div class = "kforum-pathway-bottom"> <?php echo $this->kunena_pathway1; ?> </div> <?php else: ?> <div class="kblock"> <div class="kheader"> <h2><span>Hidden Content :</span></h2> </div> <div class="kcontainer"> <div class="kbody"> <div class="khelprulescontent"> <center><b>You need more than 10 posts to access the content here.</b></center> </div> </div> </div> </div> <?php endif; ?> <?php else: ?> <?php if ($this->headerdesc) : ?> <div id="kforum-head" class="<?php echo isset ( $this->catinfo->class_sfx ) ? ' kforum-headerdesc' . $this->escape($this->catinfo->class_sfx) : '' ?>"> <?php echo $this->headerdesc ?> </div> <?php endif ?> <?php $this->displayPoll(); CKunenaTools::showModulePosition( 'kunena_poll' ); $this->displayThreadActions(0); ?> <div class="kblock"> <div class="kheader"> <h2><span><?php echo JText::_('COM_KUNENA_TOPIC') ?> <?php echo $this->escape($this->kunena_topic_title) ?></span></h2> <?php if ($this->favorited) : ?><div class="kfavorite"></div><?php endif ?> </div> <div class="kcontainer"> <div class="kbody"> <?php foreach ( $this->messages as $message ) $this->displayMessage($message) ?> </div> </div> </div> <?php $this->displayThreadActions(1); ?> <div class = "kforum-pathway-bottom"> <?php echo $this->kunena_pathway1; ?> </div> <?php endif; ?> <div class="kcontainer klist-bottom"> <div class="kbody"> <div class="kmoderatorslist-jump fltrt"> <?php $this->displayForumJump (); ?> </div> <?php if (!empty ( $this->modslist ) ) : ?> <div class="klist-moderators"> <?php echo '' . JText::_('COM_KUNENA_GEN_MODERATORS') . ": "; $modlinks = array(); foreach ( $this->modslist as $mod ) { $modlinks[] = CKunenaLink::GetProfileLink ( intval($mod->userid) ); } echo implode(', ', $modlinks); ?> </div> <?php endif; ?> </div> </div>
Last edit: 14 years 2 months ago by C0n.

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

More
14 years 2 months ago #111187 by sozzled
What would be really good is if this hack could be turned into a plugin so that the limitation (10 posts) would be configurable. This plugin could then be installed on someone's forum and then you wouldn't have to edit the source code.

Thanks for working through the idea, C0n. Let's hear what the developers have to say. :)

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 2 months ago #111190 by C0n
True but like the hack they would still have to define there Categorie ID's for restrictions.

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

More
14 years 2 months ago #111199 by Matias
Cool hack.

There's just an easier way to do this, thanks to some code that has been taken from K2.0. :)

But first: there's no need to make SQL query as user object has already been loaded. You can get the current user by KunenaFactory::getUser(); which contains the post count.

Back to subject: you can control read access to the categories from one file which is located in /admin.../libraries/integration/access.php

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 2 months ago - 14 years 2 months ago #111205 by C0n
Sounds more efficient rather than creating extra queries that could decrease perfomance
Code:
$user =& KunenaFactory::getUser();

I will take a look at the access.php and see how this can be improved.
Last edit: 14 years 2 months ago by C0n.

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

Time to create page: 3.037 seconds