При такой интеграции, в модуле JComments, остаются ссылки на com_comnent, меня сегодня спросили как это исправить, решил выложить для всех, может пригодится. Менял запросы к БД и линки в зависимости от $object_group. Во вложении измененый файл mod_jcomments.php, напрямую лучше не заменять, т.к. предыдущая версия модуля, что изменилось не проверял.
Вложить не получилось. вот функция для примера
function modJCommentsLatestCommented( &$params ) {
global $mainframe, $my;
$dbo = & JCommentsFactory::getDBO();
$acl = & JCommentsFactory::getACL();
$config = & JCommentsFactory::getConfig();
$type_com = $params->get( 'select_component' );
$object_group = trim($params->get('object_group', 'com_content'));
if ( $object_group == 'com_content' ) {
$sectionid = intval($params->get('sectionid'));
$exclude_sectionid = trim($params->get('exclude_sectionid', ''));
$exclude_sections = array();
if ($exclude_sectionid != '') {
$exclude_sections = explode(',', $exclude_sectionid);
}
$catid = intval($params->get('catid'));
$exclude_catid = trim($params->get('exclude_catid', ''));
$exclude_catids = array();
if ($exclude_catid != '') {
$exclude_catids = explode(',', $exclude_catid);
}
$class ='news-com';
$query = "SELECT c.title, c.do_title ,c.id, COUNT(cc.id) AS comments "
. "\n ,cc.name , cc.date, c.id as slug, cc.id as catslug"
. "\n FROM #__content AS c "
. "\n LEFT JOIN #__jcomments AS cc ON c.id = cc.object_id"
. "\n WHERE cc.published = '1'"
. "\n AND c.access <= '$my->gid'"
. "\n AND (c.publish_up = '0000-00-00 00:00:00' OR c.publish_up <= NOW())"
. "\n AND (c.publish_down = '0000-00-00 00:00:00' OR c.publish_down >= NOW())"
. "\n AND cc.object_group = 'com_content'"
. ((!$catid && $sectionid)? "\n AND (c.sectionid IN ($sectionid) )" : '')
. (count($exclude_sections)? "\n AND (c.sectionid NOT IN (".implode(',', $exclude_sections).") )" : '')
. ($catid ? "\n AND (c.catid IN ($catid) )" : '')
. (count($exclude_catids)? "\n AND (c.catid NOT IN (".implode(',', $exclude_catids).") )" : '')
. "\n GROUP BY c.id "
. "\n ORDER BY comments DESC"
. "\n LIMIT " . intval( $params->get( 'count' ) )
;
} elseif ($object_group == 'com_idoblog' ) {
$class ='name';
$query = "SELECT c.title ,c.id, COUNT(cc.id) AS comments "
. "\n ,cc.name , cc.date, ic.title as comtitle, ic.id_community_category as icc , ic.community_keyword as com_key, cc.object_group"
. "\n FROM #__content AS c "
. "\n LEFT JOIN #__jcomments AS cc ON c.id = cc.object_id"
. "\n LEFT JOIN #__idoblog_communities AS ic ON c.catid = ic.id_category "
. "\n WHERE cc.published = '1'"
. "\n AND cc.object_group = '".$object_group."'"
. "\n GROUP BY c.id "
. "\n ORDER BY comments DESC"
. "\n LIMIT " . intval( $params->get( 'count' ) )
;
} elseif ($object_group == 'com_eventlist' ) {
$query = "SELECT ev.title ,ev.id, evc.catname, COUNT(cc.id) AS comments "
. "\n , cc.title as comtitle "
. "\n FROM #__jcomments AS cc"
. "\n LEFT JOIN #__eventlist_events AS ev ON cc.object_id = ev.id "
. "\n LEFT JOIN #__eventlist_categories AS evc ON ev.catsid = evc.id "
. "\n WHERE cc.published = '1'"
. "\n AND cc.object_group = '".$object_group."'"
. "\n GROUP BY ev.id "
. "\n ORDER BY comments DESC"
. "\n LIMIT " . intval( $params->get( 'count' ) )
;
}
//echo $query;
$dbo->setQuery( $query );
$rows = $dbo->loadObjectList();
//print_r($rows);
if ( sizeof( $rows ) ) {
echo '<ul class="headers-list">'."\n";
foreach( $rows as $row ) {
$link = JCommentsObjectHelper::getLink( $row->object_id, $row->object_group);
//$title = JCommentsText::censor($row->comment );
//echo $title;
if (JCOMMENTS_JVERSION == '1.5' && $object_group != 'com_idoblog') {
require_once (JPATH_ROOT.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid)). '&Itemid=2#comments';
} elseif ($object_group != 'com_idoblog') {
$_Itemid = $mainframe->getItemid($row->id);
$link = sefRelToAbs('index.php?option=com_content&task=view&id=' . $row->object_id . '&Itemid=' . $_Itemid . '#comments');
}
if ($object_group == 'com_idoblog') {
$link = JRoute::_('index.php?option=com_idoblog&task=viewpost&id='. $row->id.'&Itemid=6#comment'.$row->id);
}
if ($object_group == 'com_eventlist') {
$_Itemid = 3;
$link = JRoute::_('index.php?view=details&id='. $row->id.'&option=com_eventlist&Itemid='.$_Itemid.'#comment'.$row->id);
}
$link_title = $row->title;
$link_text = $row->title;
if(!empty($link_title)) {
if ( $params->get( 'showcomments' ) ) {
$link_text .= ' <a class="comments-link" href="'.$link.'">' . $row->comments . '</a>';
}
echo '<li id="1"><div class="dt">';
echo $row->do_title.' <a href="'.$link.'" title="'.$link_title.'" class="'.$class.'">'.$link_text.'</a></div>'."\n";
if (!empty($row->comtitle) && $row->icc != 0 ) {
$link_com = JRoute::_('index.php?option=com_idoblog&keyword='. $row->com_key.'&Itemid=6');
echo '<a href="'.$link_com.'" title="'.$row_comtitle.'" class="club-link">'.$row->comtitle.'</a> '."\n";
}
if (!empty($row->catname) ) {
$link_com = JRoute::_('index.php?option=com_idoblog&keyword='. $row->com_key.'&Itemid=6');
echo '<span class="pre-name">'.$row->catname.'</span> '."\n";
}
echo '</li>';}
}
echo '</ul>'."\n";
}
}