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

Topics that are moved into this category are generally considered to be closed. Users may want to add additional information but these topics should not be resurrected in order to discuss new problems or unrelated matters.

Solved KunenaDiscuss messing up article id (from JInput) | Fix included

More
7 years 2 months ago - 7 years 2 months ago #1 by ruud
Hi, I have a module that will display the latest articles from the same category as the displayed article.

All fine except when there is a post avaialble on Kunena that is displayed via KunenaDiscuss.

here is what happens:
when I var_dump JFactory::getApplication(); I get the followinf JInput information:
Code:
object(JInput)#11 (4) { ["options":protected]=> array(0) { } ["filter":protected]=> object(JFilterInput)#12 (8) { ["stripUSC"]=> int(0) ["tagsArray"]=> array(0) { } ["attrArray"]=> array(0) { } ["tagsMethod"]=> int(0) ["attrMethod"]=> int(0) ["xssAuto"]=> int(1) ... ["data":protected]=> &array(5) { ["Itemid"]=> string(4) "1811" ["option"]=> string(11) "com_content" ["view"]=> string(7) "article" ["catid"]=> int(87) ["id"]=> int(1020) } ...

As you can see the article id is 1020... but that real article id is 522???
1020 is the Kunena thread_id!!!

This means that all plugins / modules that need to handle the article id will go in error...

when I turn of KunenaDiscuss the values are correct:
Code:
... ["data":protected]=> &array(5) { ["Itemid"]=> string(4) "1811" ["option"]=> string(11) "com_content" ["view"]=> string(7) "article" ["catid"]=> int(87) ["id"]=> int(522) } ...

sharing = caring
Last edit: 7 years 2 months ago by ruud.

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

More
7 years 2 months ago - 7 years 2 months ago #2 by ruud
this method is where it goes wrong:
Code:
protected function showTopic(KunenaForumCategory $category, KunenaForumTopic $topic, $link_topic) { if (!$topic->exists()) { $this->debug("showTopic: No messages to render"); return ''; } $this->debug("showTopic: Rendering discussion"); $ordering = $this->params->get('ordering', 1); // 0=ASC, 1=DESC $params = array( 'catid' => $category->id, 'id' => $topic->id, 'limitstart' => (int) !$ordering, 'limit' => $this->params->get('limit', 25), 'filter_order_Dir' => $ordering ? 'desc' : 'asc', 'templatepath' => __DIR__ . '/tmpl' ); ob_start(); KunenaForum::display('topic', 'default', null, $params); $str = ob_get_contents(); ob_end_clean(); return $link_topic . $str; }
before call KunenaForum::display('topic', 'default', null, $params);
the id = 522 after the id = 1020

so in KunenaForum::display the following code sets the article id to topic id
Code:
// Render the view. $view->displayLayout($layout, $template);

This is far as I get :(

sharing = caring
Last edit: 7 years 2 months ago by ruud.

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

More
7 years 2 months ago #3 by ruud
This would be a 'work-around' or if reworked a fix. Can somebody have a look?
Code:
protected function showTopic(KunenaForumCategory $category, KunenaForumTopic $topic, $link_topic) { if (!$topic->exists()) { $this->debug("showTopic: No messages to render"); return ''; } $this->debug("showTopic: Rendering discussion"); // FIX: Store article's ID $article_id = $this->app->input->get('id'); $ordering = $this->params->get('ordering', 1); // 0=ASC, 1=DESC $params = array( 'catid' => $category->id, 'id' => $topic->id, 'limitstart' => (int) !$ordering, 'limit' => $this->params->get('limit', 25), 'filter_order_Dir' => $ordering ? 'desc' : 'asc', 'templatepath' => __DIR__ . '/tmpl' ); ob_start(); KunenaForum::display('topic', 'default', null, $params); $str = ob_get_contents(); ob_end_clean(); // FIX: Set article's ID back $this->app->input->set('id', $article_id); return $link_topic . $str; }

sharing = caring

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

More
6 years 11 months ago #4 by ruud
fix implemented in Kunena 5.0.8 :)
topic can be set to solved

sharing = caring

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

Time to create page: 0.373 seconds