By neoman on Monday, 04 March 2019
Posted in General Issues
Likes 0
Views 657
Votes 0
How can I query in a joomla article if komento is activated. I would like to show the number of comments with an override of a joomla article. If komento is deactivated via the backend, the number of comments in the joomla article must also be deactivated.

Please help. Thanks
I am sorry but I do not really understand what you are trying to achieve here. Can you please elaborate more about what you are trying to achieve here?
·
Monday, 04 March 2019 21:37
·
0 Likes
·
0 Votes
·
0 Comments
·
I want to show the number of comments in the Joomla article (with override). I do that with the following code.


$commentsModel = KT::model('Comments');
$commentsCount = $commentsModel->getTotal('com_content', $displayData['item']->id);
echo $commentsCount;


If I deactivate Komento via the backend, the number of comments will still be displayed.

That's why I need a query to turn off the number of comments when Komento disabled.
·
Monday, 04 March 2019 22:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

Correct me if i am wrong. By default, on Joomla articles does counter will be shown as you can see here https://take.ms/vE0sX. To shown them on Joomla Articles, you will need to enable this settings https://take.ms/cqYif. By the way, may i know where exactly those modifications are done? Is it on single articles or on all pages layout?

That's why I need a query to turn off the number of comments when Komento disabled.

May i know that you referring to this settings https://take.ms/FWMoc? If yes, you can try to use codes below and see how it goes.

[gist type="php"]
$config = KT::config();

if (!$config->get('enable_komento')) {
return false;
}
[/gist]
·
Tuesday, 05 March 2019 13:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

the code works. However, the comment counter counts wrong. I want to achieve the same thing as in this thread. The counter should be in the info_block. My code now looks like the attachment.

Is this correct?
·
Tuesday, 05 March 2019 15:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You will need to recheck this $displayData['item']->id again on codes below. You can dump($commentCount, $displayData['item']->id); to see if those counters and data is correct or not.

$commentCount = $commentsModel->getTotal('com_content', $displayData['item']->id);


Having said that, if you require us to perform the customization for you, you can always request for a quote from us at https://crm.stackideas.com and select "Customizations" . Our sales person would be glad to send you a quote for the customizations that you have requested.

Thanks for your understanding.
·
Tuesday, 05 March 2019 16:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

it works with this call.

$commentCount = $commentsModel->getCount('com_content', $displayData['item']->id);

Thanks
·
Tuesday, 05 March 2019 16:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding.
·
Tuesday, 05 March 2019 16:30
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post