JComments

Integration of JComments to DatsoGallery image gallery

DatsoGallery — pne of the most popular image galleries for Joomla. It is based on AkoGallery and PonyGallery components. The offered to your attention integration is inteneded to replace the built-in comment system by JComments.

  1. Open file /components/com_datsogallery/datsogallery.php
  2. Find lines:
      $database->setQuery("SELECT cmtid FROM #__datsogallery_comments WHERE cmtpic='$row1->id'");
      $comments_result = $database->query();
      $comments = mysql_num_rows($comments_result);
    and replace with:
      global $mosConfig_absolute_path;
      $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
      if (file_exists($comments)) {
        require_once($comments);
        $comments = JComments::getCommentsCount($row1->id, 'com_datsogallery');
      }
  3. Open file /components/com_datsogallery/sub_viewdetails.php
  4. Find line:
      if ($ad_showcomment) {
    and replace with:
    /*  if ($ad_showcomment) { 
  5. Find line:
        if ($ad_showsend2friend) {
    and replace with:
    */    if ($ad_showsend2friend) {
  6. At the and of file find line:
    ?>
    and replace it with:
      if ($ad_showcomment) {
        global $mosConfig_absolute_path;
        $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
        if (file_exists($comments)) {
          require_once($comments);
          echo JComments::showComments($id, 'com_datsogallery', $imgtitle);
        }
      }    
    ?>
  7. Open file /components/com_datsogallery/sub_viewspecial.php
  8. Find lines:
      $database->setQuery("select cmtid from #__datsogallery_comments where cmtpic='$row1->id'");
      $comments_result = $database->query();
      $comments = mysql_num_rows($comments_result);
    and replace with:
      global $mosConfig_absolute_path;
      $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
      if (file_exists($comments)) {
        require_once($comments);
        $comments = JComments::getCommentsCount($row1->id, 'com_datsogallery');
      }
  9. Find lines:
      $database->setQuery("select a.*, cc.cmtid "
      . " from #__datsogallery as a, #__datsogallery_comments "
      . " as cc, #__datsogallery_catg "
      . " as ca where a.id=cc.cmtpic "
      . " and a.catid=ca.cid "
      . " and a.published=1 "
      . " and a.approved=1 "
        . " and ca.published=1 "
      . " and ca.access<=$gid "
      . " order by cc.cmtid desc limit $ad_toplist ");
    and replace with:
      $database->setQuery("select a.* "
      . " from #__datsogallery as a"
      . " inner join #__datsogallery_catg as ca on a.catid = ca.cid"
      . " inner join #__jcomments as cc on a.id = cc.object_id"
      . " where a.published=1 and a.approved=1 "
      . " and cc.object_group='com_datsogallery' and cc.published=1 "
      . " and ca.published=1 and ca.access<=$gid "
      . " order by cc.date desc limit $ad_toplist ");

Useful links:

 
JoomlaTune