JoomlaTune - developers of the JComments extension - offers the following code to display comments anywhere:
<?php
$comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once($comments);
$options = array();
$options['object_id'] = $this->item->id;
$options['object_group'] = 'com_content';
$options['published'] = 1;
$count = JCommentsModel::getCommentsCount($options);
echo ('<span>'. $count .'</span>');
}
?>
by substituting the id of the article into $this->item->id you can get the number of materials for this article.
Is it possible to somehow adapt this code to display the number of comments left by specific users by his id. Or maybe this variable already exists somewhere in the component code?
Thanks a lot in advance!
JComments::showComments
function that you should be able to get all comments then loop through them to filter out comments from specific users?