Keyword

Block Disqus from certain pages.

  • redmonds
  • redmonds's Avatar Topic Author
  • Offline
  • New Member
More
15 years 1 month ago #21508 by redmonds
Block Disqus from certain pages. was created by redmonds
I am looking at using Disqus for commenting although I believe that this is a joomla config that I am looking for.

How do I block any commenting system from appearing on specific pages. IE Terms and COnditions/ Policy pages. I don;t want ratings (i worked this out) or comments for these pages.

Thanks

Ral

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago #21509 by monkeyman
Replied by monkeyman on topic Re: Block Disqus from certain pages.
Yeah, this is what I came here for, but found no solution. Right now you can only disable sections/categories or menu items, but not particular articles, which is bad, bad, bad.

For example, I have a certain category as menu item and I don't want to see Disqus only in some articles from this category. Can't do.

Please, add this feature. It's very easy to implement. Put something like {disqus off} in article and parse it with plugin.

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago - 13 years 1 month ago #21510 by monkeyman
Replied by monkeyman on topic Re: Block Disqus from certain pages.
Actually, I did it myself already. So if anyone want to exclude Disqus comments from particular articles do the following:

1. Open article.php in plugins/jw-disqus/tmpl folder and change everything BELOW "<!-- Disqus Comments -->" string on this:
<?php

$switchregex = "#{disqus (on|off)}#s";

if (strpos($row->text, '{disqus off}') === false )
{
	echo preg_replace($switchregex, '', $row->text);
	echo "<hr /><div class='jwDisqusForm'>".$output->comments."</div><div class='jwDisqusBackToTop'><a href='".$output->itemURL."#startOfPage'>".JText::_("back to top")."</a><div class='clr'></div></div><div class='clr'></div>";	
}
else
{
	echo preg_replace($switchregex, '', $row->text);
}
?>

2. Remove this ABOVE "<!-- Disqus Comments -->" string:
<?php echo $row->text; ?>

<hr />

3. Then if you want to disable Disqus comments, just put {disqus off} in any place of your article.

4. Enjoy!

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #21511 by jason559
Replied by jason559 on topic Re: Block Disqus from certain pages.
When I place "{disqus off}" (without quotes) in an article, I just get that same thing shown in the article.  Am I doing something wrong?  I made the changes to article.php

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #21512 by monkeyman
Replied by monkeyman on topic Re: Block Disqus from certain pages.

When I place "{disqus off}" (without quotes) in an article, I just get that same thing shown in the article.  Am I doing something wrong?  I made the changes to article.php

Can't really say, man. Works pretty fine on me and should work on others. These changes are very simple actually.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #21513 by jason559
Replied by jason559 on topic Re: Block Disqus from certain pages.
Just wanted to double check, are you using 1.5?
My articles.php was located in /htdocs/plugins/content/jw_disqus/tmpl

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #21514 by monkeyman
Replied by monkeyman on topic Re: Block Disqus from certain pages.

Just wanted to double check, are you using 1.5?
My articles.php was located in /htdocs/plugins/content/jw_disqus/tmpl

Yep, Joomla 1.5.22 here. Same folder as well.
Try to change the whole code in your article.php to mine:
<?php 
/*
// JoomlaWorks "Disqus Comment System" Plugin for Joomla! 1.5.x - Version 2.2
// Copyright (c) 2006 - 2009 JoomlaWorks Ltd. All rights reserved.
// Released under the GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
// More info at https://www.joomlaworks.net
// Designed and developed by the JoomlaWorks team
// ***Last update: November 14th, 2009***
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

?>

<span id="startOfPage"></span>

<?php if($disqusArticleCounter): ?>
<!-- Disqus comments counter and anchor link -->
<div class="jwDisqusArticleCounter">
	<a class="jwDisqusArticleCounterLink" href="<?php echo $output->itemURL; ?>#disqus_thread"><?php echo JText::_('View Comments'); ?></a>
	<div class="clr"></div>
</div>
<?php endif; ?>

<!-- Disqus Comments -->
<?php

$switchregex = "#{disqus (on|off)}#s";

if (strpos($row->text, '{disqus off}') === false )
{
	echo preg_replace($switchregex, '', $row->text);
	echo "<!--hr /--><div class='jwDisqusForm'>".$output->comments."</div><div class='jwDisqusBackToTop'><a href='".$output->itemURL."#startOfPage'>".JText::_("back to top")."</a><div class='clr'></div></div><div class='clr'></div>";	
}
else
{
	echo preg_replace($switchregex, '', $row->text);
}
?>

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #21515 by jason559
Replied by jason559 on topic Re: Block Disqus from certain pages.
Hum, using 1.5.22 here too...  Copied your articles.php and replaced mine completely.  Still having the same problem.  So frustrating, I just really need to remove disqus from about 3 articles.  SO wish there was a way to fix this.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum