Disqus Comments for RavenNuke

Adding Disqus to Content Plus

 
 
Disqus Comments for RavenNuke

Disqus is a comments platform that helps you build an active community from your website's audience. It has awesome features, powerful tools, and it's easy to install. A few quick edits, and you too can add the powerful features of Disqus comments to all of your Content Plus content (Disqus registration required).

Optimized for use with the NEW cTopics module, which will allow you to control your Disqus settings, and included recent comments block; all from within the cTopics ACP.


Update: June 2012 - The approach for Disqus comment integration has changed since this article was originally published. It is recommended to refer to the News integration for an example instead of consulting this document. It is also worth noting that a global comments setup in on the RavenNuke roadmap, yet no guarantees as to when time will allow for it's development..


After you have completed registration with Disqus, and installed/configured the cTopics module, use a decent text editor such as notepad++ to make the following edits:
(instructions for stand-alone Disqus comments without cTopics module, as well as download this mod as a text file, see below)

Warning! Not Intended to run stand-alone! Install the cTopics module first, or see stand-alone instructions below.
 
modules/Content/index.php - function showpage

FIND:

			echo '<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script><br /><br />'.PHP_EOL;
		}

 

AFTER ADD:

		// DISQUS - NOT INTENDED FOR STAND-ALONE
		// INSTALL cTOPICS MODULE
		$DisqusSettings = $db->sql_query('SELECT * FROM '.$prefix.'_ctopics WHERE config = '1'');
		if ($DisqusSettings){
			$Dis = $db->sql_fetchrow($DisqusSettings);
			$modTitleInURL= intval($Dis['mod_seo']);
			$use_disqus = intval($Dis['use_disqus']);
			$dshort = check_html($Dis['disqus_shortname'], 'nohtml');
			}
		if (!isset($use_disqus)) $use_disqus = 0;
		if (!isset($modTitleInURL)) $modTitleInURL = 0;
		if (!isset($dshort)) $dshort = 'shortname';
		if ($use_disqus){
			$did = $module_name.'-'.$pid;
			if (function_exists('gt_url') AND $modTitleInURL){
				if (defined('TNSL_USE_SHORTLINKS')){
				$durl = $nukeurl.'/content-'.$pid.'-'.gt_url($mytitle).'.html?#39;;
				}else{
				$durl = $nukeurl.'/modules.php?name='.$module_name.'&pa=showpage&pid='.$pid.'&title='.gt_url($mytitle);
				}
			}else{
				if (defined('TNSL_USE_SHORTLINKS')){
				$durl = $nukeurl.'/content-'.$pid.'.html?#39;;
				}else{
				$durl = $nukeurl.'/modules.php?name='.$module_name.'&pa=showpage&pid='.$pid;
				}
			}
			echo '<div id="disqus_thread"></div>'.PHP_EOL;
			echo '	<script type="text/javascript">'.PHP_EOL;
			echo '		var disqus_shortname = ''.$dshort.'';'.PHP_EOL;
			echo '		var disqus_identifier = ''.$did.'';'.PHP_EOL;
			echo '		var disqus_url = ''.$durl.'';'.PHP_EOL;
			echo '		(function() {'.PHP_EOL;
			echo '			var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;'.PHP_EOL;
			echo '			dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';'.PHP_EOL;
			echo '			(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);'.PHP_EOL;
			echo '		})();'.PHP_EOL;
			echo '	</script>'.PHP_EOL;
			echo '	<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>'.PHP_EOL;
			echo '	<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a><br />'.PHP_EOL;
		}
		// DISQUS

 

Upload your modified file, and provided all your settings, configuration, and edits are correct you should now have a Disqus enabled site! Below are instructions for those of whom who want to add to Content Plus WITHOUT using the cTopics module.

Warning! These are the stand-alone instructions. Only use if you are NOT using the code above and/or the cTopics module.
 
modules/Content/index.php - function showpage

FIND:

			echo '<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script><br /><br />'.PHP_EOL;
		}

 

AFTER ADD:

		// DISQUS - STAND-ALONE VERSION
			$dshort = 'shortname'; // enter your actual shortname
			$did = $module_name.'-'.$pid;
			if (defined('TNSL_USE_SHORTLINKS')){
			$durl = $nukeurl.'/content-'.$pid.'.html?#39;;
			}else{
			$durl = $nukeurl.'/modules.php?name='.$module_name.'&pa=showpage&pid='.$pid;
			}
			echo '<div id="disqus_thread"></div>'.PHP_EOL;
			echo '	<script type="text/javascript">'.PHP_EOL;
			echo '		var disqus_shortname = ''.$dshort.'';'.PHP_EOL;
			echo '		var disqus_identifier = ''.$did.'';'.PHP_EOL;
			echo '		var disqus_url = ''.$durl.'';'.PHP_EOL;
			echo '		(function() {'.PHP_EOL;
			echo '			var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;'.PHP_EOL;
			echo '			dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';'.PHP_EOL;
			echo '			(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);'.PHP_EOL;
			echo '		})();'.PHP_EOL;
			echo '	</script>'.PHP_EOL;
			echo '	<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>'.PHP_EOL;
			echo '	<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a><br />'.PHP_EOL;
		// DISQUS

 

Modifications in the form of a text file are available via the Download button below

 
 
 
Download View Demo
 
 
 
 
 
 
Comments powered by Disqus
 
 
Posted: November 23, 2010 08:33 PM EST   Category: RavenNuke Tweaks and Tips   16676 Reads
 
 
Papa Mike Creations
 
 

Site Info

Server TrafficServer Traffic
  • Total: 6,558,982
  • Today: 5,275
Server InfoServer Info
  • Nov 22, 2017
  • 08:00 pm UTC