Kunena 7.0.4 Released

The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] 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

Topics contains old discussions (generally more than one year ago or based on circumstances that subsequently changed) or topics resolved in other ways. Topics moved into this category are closed from further discussion.

Question Specifying forums that the search function is only allowed to search in. (Solved)

More
16 years 6 months ago #31499 by Superderek
Sorry for being a bit of a newb but where would I specify which ids are not allowed to be searched?

I looked through but I can't seem to get it to work.
Thanks again for the location but for some reason I am having problems. If you could, where would I specify which id are not allowed within the code:
Code:
function get_search_forums(&$catids, $childforums = 1) { $fbSession =& CKunenaSession::getInstance(); $kunena_db = &JFactory::getDBO(); $kunena_my = &JFactory::getUser(); /* get allowed forums */ $allowed_string = ''; if ($fbSession->allowed && $fbSession->allowed != 'na') { $allowed_string = "id IN ({$fbSession->allowed})"; } else { $allowed_string = "published='1' AND pub_access='0'"; } $kunena_db->setQuery("SELECT id, parent FROM #__fb_categories WHERE {$allowed_string}"); $allowed_forums = $kunena_db->loadAssocList('id'); check_dberror("Unable to get public categories."); $allow_list = array(); foreach ($allowed_forums as $forum) { // Children list: parent => array(child1, child2, ...) $allow_list[$forum['parent']][] = $forum['id']; } $catids = split(',', $catids); $result = array(); if (count($catids) > 0 && !in_array(0, $catids)) { // Algorithm: // Start with selected categories and pop them from the catlist one by one // Every popped item in the catlist will be added into result list // For every category: push all its children into the catlist while ($cur = array_pop($catids)) { $result[$cur] = $cur; if (array_key_exists($cur, $allow_list)) foreach ($allow_list[$cur] as $forum) if (!in_array($forum, $catids)) array_push($catids, $forum); } $search_forums = implode(",", $result); } else { $search_forums = implode(",", array_keys($allowed_forums)); } return $search_forums;
Thanks in advance.

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

More
16 years 6 months ago - 16 years 6 months ago #31562 by Matias
Well, you need to alter the code a bit..

Easiest way might be this (end of the function, not tested):
Code:
$search_forums = array_keys($result); } else { $search_forums = array_keys($allowed_forums); } $search_forums = array_flip($search_forums); unset($search_forums[1], $search_forums[3], $search_forums[5]); $search_forums = array_flip($search_forums); $search_forums = implode(",", $search_forums); return $search_forums;

unset() will do the job..
Last edit: 16 years 6 months ago by Matias.

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

More
16 years 6 months ago #31741 by Superderek
It seems to be a huge success! Thank you very much. I typed in every key word I could think of that would reveal the secret thread within the secret forum. Nothing appears except for search results from the forums that I didn't block. Thanks again, this means a lot.

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

Time to create page: 0.249 seconds