Community Documentation

v3 Knowledgebase

How to integrate comment system

**This tutorial requires a source edit if you are not using a custom template. Do so at your own risk as it will void support, be overwritten on upgrades, can cause issues with other modules that use the same file, can cause instability on the site and can cause the site to be less secure. It is recommended instead to use a custom template and do the template override method mentioned.

Follow this tutorial for add on your site.

If you don't know disqus, check about page:

The first step it's register your new account, here:

When he ask which integration you want, then select Universal Code.

After registration, you will receive an URL similar like: and you can login on a wide admin dashboard for your comments. You can manage many settings, appearance, comments, users, language, ...

Download from here the addon which will quickly install disqus:


1) Unzip folder
2) Upload to your server
3) Admincp > Extension > Import product and click install
4) Admincp > Setting > Disqus and add your disqus shortname
5) Move file from module/disqus/template/default/block/comment.html.php to module/feed/template/default/block/comment.html.php or if you are using custom theme you can move under module/feed/template/MY_THEME_NAME/block/comment.html.php
in this case replace MY_THEME_NAME with your theme name

How it work?

1) First of all we need a block with disqus code. You can find that block under module/disqus/template/default/block/display.html.php with this content:

<div id="disqus_thread"></div>
script type="text/javascript">
(function() {
dsq document.createElement('script'); dsq.type 'text/javascript'dsq.async true;
dsq.src '//' disqus_shortname '';
document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
<noscript>Please enable JavaScript to view the <a href="">Disqus.</a></noscript> 

2) We need a javascript file for reload disqus via ajax, this it's required for theater mode, we need change disqus thread via ajax. You can find the code into module/disqus/static/jscript/init.js, this are the code:

$Behavior.macMainDisqusBehavior = function()
'a.thickbox.photo_holder_image').on('click', function(){
disqus_url = $(this).attr('href');
disqus_identifier = $(this).attr('rel');
config: function () {   disqus_identifier;   disqus_url;

3) and in the last we need a plugin, which it's used for setup disqus. You can find that plugin under module/disqus/include/plugin/template_getheader.php, this are the content:

if(Phpfox::isModule('disqus')) { // load only if module is enabled

    // disallowed modules - you can add more here
$disallowedModules = array('/''''about');
$requestedPostId Phpfox::getLib('request')->get('req2');
// requested module
$requestedModule Phpfox::getLib('request')->get('req1');
// site url
$sMacSiteUrl "http://".Phpfox::getParam('').Phpfox::getParam('core.folder');
// check if guest and if module is allowed
if(!Phpfox::getUserId() && !in_array($requestedModule$disallowedModules)) {
// configuration info:
        // var disqus_developer = 1; 
$this->setHeader("head", array(
        var disqus_shortname = '"
        var disqus_url = '"
        var disqus_identifier = '"
        var disqus_category_id = '"
// end configuration
        // init disqus script
'init.js' => 'module_disqus'

4) In the last we need change view file of comment.
This file are module/feed/template/default/block/comment.html.php which can be also replaced by module/disus/template/default/block/comment.html.php
If you are running phpfox 3.7.4 then you can use that file
but if you are using another version, be sure that you are using correct comment file

The code which should be added it's:

Phpfox::isModule('disqus') &&
Phpfox::getUserId() && 
$sFeedType) &&
$sFeedType == 'view'

template file='disqus.block.display'}

HERE GO all comment.html.php default file


if want disable disqus for some page, you can add more element on array $disallowedModules = array('/', '', 'about');

Example if you don't want load disqus for blog, you can do this:

$disallowedModules = array('/', '', 'about', 'blog');

More info on disqus: