Disqus Comments Integration

How would I be able to replace the comment system with disqus (www.disqus.com). Which file should I add code to to achieve that?

Maybe somebody of you did that already? It should be definitely possible.

Thanks for any advice.

Comments

  • I really dont know but im assuming the easiest way to do this would be to delete/comment out the current code for displaying comments on your theme, then using the appropriate disqus code to add into the theme... I really dont know how disqus works so...I dunno..

    Im sure a zenphoto staff member will be along to help you :)
  • that sounds like what i was planning to do.

    disqus provides plugins for wordpress and others but has a generic javascript code that you can enter into any website.

    Do you know in which file the commenting code is located? Then ill give it a try.
  • zenphoto/themes/default/image.php
    Actually you can probably disable comments in the admin panel... This should not display them anymore...
    However you may want to modify this line...
    `<?php } else { echo gettext('Comments are closed.'); } ?>`
    Maybe to...
    `<?php } ?>`
    You need to keep that first `}` I believe...
    Anyways that is the area where you should try to implement your comment system...

    DISCLAIMER: For the record, I am a newb with zenphoto and little PHP skills. I am no expert. I am not part of the zenphoto staff and I am just a user trying to help someone out the best I can. I am not responsible for anything that goes wrong with your site. Please backup your files you play around with! Especially if I give advice! lol
  • no worries :)
    ill test everything first. if sth goes wrong no problem.
    once i manage to integrate the two ill post again for others to see how its done. thanks for the help.
  • acrylian Administrator, Developer
    I never heard of disqus, but code is right, the comment code is on image.php. Take also a look at our theming tutorial to get familar with Zenphoto's themes.
  • already got it working.

    in image.php all you got to do is deleting the following part of the comments:

    <!-- If comments are on for this image AND album... -->
    <h3><?php echo gettext("Add a comment:"); ?></h3>
    <form id="commentform" action="#" method="post">
    <div><input type="hidden" name="comment" value="1" />
    <input type="hidden" name="remember" value="1" />
    <?php
    printCommentErrors();
    $stored = getCommentStored();
    ?>
    <table border="0">
    <tr>
    <td><label for="name"><?php echo gettext("Name:"); ?></label>
    (<input type="checkbox" name="anon" value="1"<?php if ($stored['anon']) echo " CHECKED"; ?> /> <?php echo gettext("don't publish"); ?>)
    </td>
    <td><input type="text" id="name" name="name" size="20" value="<?php echo $stored['name'];?>" class="inputbox" />
    </td>
    </tr>
    <tr>
    <td><label for="email"><?php echo gettext("E-Mail:"); ?></label></td>
    <td><input type="text" id="email" name="email" size="20" value="<?php echo $stored['email'];?>" class="inputbox" />
    </td>
    </tr>
    <tr>
    <td><label for="website"><?php echo gettext("Site:"); ?></label></td>
    <td><input type="text" id="website" name="website" size="40" value="<?php echo $stored['website'];?>" class="inputbox" /></td>
    </tr>
    <?php if (getOption('Use_Captcha')) {
    $captchaCode=generateCaptcha($img); ?>
    <tr>
    <td><label for="code"><?php echo gettext("Enter Captcha:"); ?>
    <img src=<?php echo "\"$img\"";?> alt="Code" align="bottom"/>
    </label></td>
    <td><input type="text" id="code" name="code" size="20" class="inputbox" /><input type="hidden" name="code_h" value="<?php echo $captchaCode;?>"/></td>
    </tr>
    <?php } ?>
    <tr><td colspan="2"><input type="checkbox" name="private" value="1"<?php if ($stored['private']) echo " CHECKED"; ?> /> <?php echo gettext("Private (don't publish)"); ?></td></tr>
    </table>
    <textarea name="comment" rows="6" cols="40"><?php echo $stored['comment']; ?></textarea>

    <input type="submit" value="<?php echo gettext('Add Comment'); ?>" class="pushbutton" /></div>
    </form>

    Then at the same place put the code from disqus. Now I have zen photo working together with the disqus commenting system.

    Compared to coppermine that i was using before, zen photo is an absolute blessing!
Sign In or Register to comment.