×
K5.1.1 is released (10 Jun 2018)

The Kunena team is pleased to announce Kunena 5.1.1 [K 5.1.1].
Please read the blog post for information:

× Please note: The Kunena project team takes NO responsibility for maintaining nor supporting anything in this category.

Bug Joomla Menu path not used

More
4 years 9 months ago #1 by tantalus
Hi,

when I have a Joomla menu item that shows a Kunena category, that menu item is no more selected when i choose some topic within that category.

Is this wanted behaviour?
In Joomla itself, a menu item linking to a category stays active when loading some content within.

You can test this very easy:
- Install a Joomla with sample data.
- Install Kunena with sample data.
- In the menu "main menu", create a "Show Category" menu item "a" that shows the category "Welcome Mat".
- In the frontend, select the item "a", then "Welcome to Kunena!". "a" is no more active.

This happens because Kunena sets Itemid=0. Having a look at KunenaRoute::_, i see a
if (!$uri->getVar('Itemid')) {
	self::setItemID ( $uri );
}
That function seems to iterate through the menu items but does find nothing and returns 0. When if comment out the above "if", the "a" stays active, even though there is no Itemid. I think this is because the menu link "a" is a subset of the "Welcome to Kunena!" link.

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

More
4 years 9 months ago #2 by tantalus
Replied by tantalus on topic Joomla Menu path not used
As it turns out, it was the last function in the KunenaRoute class.
It only accepts items as parents whose query parts (option, view, Itemid, ...) are _all_ the same as the link to generate.

The topic links in the category have all view=topic. But my menu link has view=category, of course.

I changed the
if ($value != $uri->getVar($var)) {
into
if ($value != $uri->getVar($var) && $var !== 'view') {
in line 560 of libraries/kunena/route/route.php. Bad hack, but works for me :).

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

More
4 years 5 months ago #3 by mecenat
Replied by mecenat on topic Joomla Menu path not used
best custom writed hack i seen for kunena B)

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

More
4 years 5 months ago #4 by xillibit
Replied by xillibit on topic Joomla Menu path not used

tantalus wrote: As it turns out, it was the last function in the KunenaRoute class.
It only accepts items as parents whose query parts (option, view, Itemid, ...) are _all_ the same as the link to generate.

The topic links in the category have all view=topic. But my menu link has view=category, of course.

I changed the

if ($value != $uri->getVar($var)) {
into
if ($value != $uri->getVar($var) && $var !== 'view') {
in line 560 of libraries/kunena/route/route.php. Bad hack, but works for me :).

In Kunena 3.0.4 this part has changed so you can't aplly anymore this hack

I don't provide support by PM, because this can be useful for someone else.

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

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