Сергей, спасибо что откликнулся.
Запоминаем количество просмотренных пользователей комментариев:
файл шаблона tpl_tree.php, функция render(), добавить в начало
(время жизни и название куки, возможно, требует пересмотра)
$object_id = $this->getVar('comment-object_id');
$object_group = $this->getVar('comment-object_group');
$count = JComments::getCommentsCount($object_id, $object_group);
$user =& JFactory::getUser();
if ($user->id != 0) setcookie ($user->id.$object_group.$object_id, $count, time() + 3600*24*60,'/');
Если пользователь добавляет комментарий, учитываем это
jcomments.ajax.php, function addComment, строка 520 добавить:
if ($comment->userid != 0) setcookie ($comment->userid.$comment->object_group.$comment->object_id, $count, time() + 3600*24*60,'/');
У меня настроен свой вывод комментариев, но скорее всего для стандартного отображения изменяем tpl_links.php, function getCommentsLink()
строка 92, заменяем
switch($style) {
case -1:
return '<span class="' . $css . '">' . $text . '</span>';
break;
default:
return '<a href="' . $link . '#comments" class="' . $css . '">' . $text . '</a>';
break;
}
на
$object_id = $this->getVar('comment-object_id');
$object_group = $this->getVar('comment-object_group');
$user =& JFactory::getUser();
if ($user->id != 0) {
$sessioncount=(int) $_COOKIE[$user ->id.$object_group.$object_id];
$css .= ((int)$count > $sessioncount)? ' newcomments' : '';
$newcommentsTitle = ((int)$count > $sessioncount)? JTEXT::_('NEW COMMENTS') : JTEXT::_('NO NEW COMMENTS'); //для добавления в титл ссылки
}
switch($style) {
case -1:
return '<span class="' . $css .$newcomments '" title=".$newcommentsTitle.">' . $text . '</span>';
break;
default:
return '<a href="' . $link . '#comments" class="' . $css . '" title=".$newcommentsTitle.">' . $text . '</a>';
break;
}
Последнее - не проверял, но должно работать.