I recently upgraded from Kunena 1.5 to Kunena 3

In Kunena 3 the ID in the SEF URL refers to the topic ID rather then message ID.
This is better for SEO, but old messages links from before the update are not working anymore unless they are the first message in a thread.

By inserting this bit of code into the components/com_kunena/router.php
after line 223 you can replace the message ID with topic ID, if the url contains a message ID rather then topic ID
That makes sure that your old Kunena URL’s still work after the update.

 

$db = JFactory::getDBO() ;

$sql = ‘select * from #__kunena_topics where id = ‘ . intval( $value ) . ‘ limit 1′ ;
$db->setQuery($sql ) ;
$r = $db->loadObject() ;

if(!$r) {
$sql = ‘select * from #__kunena_messages where id = ‘ .intval( $value ) . ‘ limit 1′ ;
$db->setQuery($sql ) ;
$r = $db->loadObject() ;
if($r) {
$value = $r->thread ;
$vars ['mesid'] = $r->id ;
}
}

 

locate the following bit of code in the router.php file – should be at line 223 and insert the above code just after $sefcats = false;

elseif (empty($vars ['id'])) {
// Second number is always topic
$var = 'id';
$vars ['view'] = 'topic';
$sefcats = false;