Posts Tagged ‘comment’
Using Disqus Plugin in Joomla
Disqus Comment System is a plugin that provides seamless integration between Joomla and the popular commenting system Disqus.
Installing the plugin is pretty straightforward but there are a few gotcha’s.
Troubleshooting
No comments/links are showing up.
- Check if the plugin is enabled. (not enabled by default)
- Open template/html/com_content/article/default.php and make sure that the following lines exist.
<?php echo $this->article->event->beforeDisplayContent; ?> ... <?php echo $this->article->event->afterDisplayContent; ?>
There is no Add New Comment section.
- Verify your plugin setting. The subdomain value should only be the name and not the entire URL. ie. mysite
.disqus.com
Adding an Exclude List
Currently, there’s no setting for enabling/disabling comments per article so I did a few hacks.
plugins/content/jw_disqus.xml – Add this line before the </param> tag
<param name="disqus_excludelist" type="text" default="" label="Exclude list" description="Do no show comments for articles having these ids (comma separated)" />
plugins/content/jw_disqus.php – Create a new function that checks if the id of the article is in the exclude list.
/**
* Check if the id of the current article is included in the excludelist parameter
*/
function isExcluded($article_id){
$plugin =& JPluginHelper::getPlugin('content', 'jw_disqus');
$pluginParams = new JParameter( $plugin->params );
$disqus_excludelist = $pluginParams->def('disqus_excludelist','');
if(in_array($article_id, explode(',', $disqus_excludelist))) {
return true;
}
return false;
}
Now simply return nothing in the callback functions if the article is in the exclude list.
/** just before content is output, returns output to be displayed */
function plgJWDisqus_onBeforeDisplayContent( &$row, &$params, $limitstart ){
if(isExcluded($row->id)) {
return;
}
...
/** just after content is output, returns output to be displayed */
function plgJWDisqus_onAfterDisplayContent( &$row, &$params, $limitstart ){
if(isExcluded($row->id)) {
return;
}
...
You should be all set after this.