×
Kunena 5.2 Beta 1 Released (24 Sep 2020)

The Kunena team is thrilled to announce the first public beta release of Kunena 5.2, a native Joomla extension for Joomla 3.9. This is a development release and should be only be used for testing; this version is not recommended for live websites at this stage.

The purpose of this release is to encourage testing by downloading, installing and identifying any problems or shortcomings that people may discover. K 5.2.0 B1 is stable and we are aware that people will discover defects. We encourage you to use the forum to report defects, as soon as they are discovered, so that the development team can work through the problems before the release of K 5.1 as a stable product. Reporting defects does not mean that the problems can or will be fixed. The Kunena team is looking forward to hearing your feedback on how well we have achieved our design goals.

× 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
3 years 7 months ago - 3 years 7 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:
              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:
...
                ["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: 3 years 7 months ago by ruud.

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

More
3 years 7 months ago - 3 years 7 months ago #2 by ruud
this method is where it goes wrong:
        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
                // Render the view.
                $view->displayLayout($layout, $template);

This is far as I get :(

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

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

More
3 years 7 months ago #3 by ruud
This would be a 'work-around' or if reworked a fix. Can somebody have a look?
	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
3 years 4 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.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.087 seconds