JComments

Integration of JComments to LinkDirectory

LinkDirectory — is a link directory for Joomla with possibility to add new links by site visitors and lot of settings. Unfortunately the development of this component is stopped and author even close the web-site. But the component is still popular and used on many sites. The offered to your attention integration is inteneded to replace the built-in comment system by JComments.

  1. Open file /components/com_linkdirectory/linkdirectory.tools.php
  2. Find lines:
    function TotalComment(&$id) {
    global $database;
     
      $query = "SELECT count(*) FROM #__ldcomment"
      . "\n WHERE link_id = $id"
      . "\n AND rev_approved = 1"
      ;
      
      $database->setQuery($query);
      $totalcomment = $database->loadResult();
      
      echo $totalcomment;
    }
    and replace them with:
    function TotalComment(&$id) {
      global $mosConfig_absolute_path;
     
      $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
      if (file_exists($comments)) {
        require_once($comments);
     
        echo JComments::getCommentsCount($id, 'com_linkdirectory');
      
      }
      echo '0';
    }
  3. Open file/components/com_linkdirectory/linkdirectory.comments.php
  4. Find line:
    $temp->display('addcomment.tpl.php');
    and replace with:
    $temp->display('showcomments.tpl.php');
  5. Open file /components/com_linkdirectory/linkdirectory.links.php
  6. Find lines:
    //Get total comments
    $query = "SELECT COUNT( rev_id )"
      . "\n FROM #__ldcomment"
      . "\n WHERE link_id = ". $row->id
      . "\n AND rev_approved = 1"
      ;
     
    $database->setQuery( $query );
    $comment = $database->loadResult();
    $row->comment = $comment;
    and replace with:
      global $mosConfig_absolute_path;
     
      $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
      if (file_exists($comments)) {
        require_once($comments);
     
        $row->comment = JComments::getCommentsCount($row->id, 'com_linkdirectory');
      
      }
  7. Open file /components/com_linkdirectory/templates/default/showcomments.tpl.php
  8. Find lines:
    <?php echo LDReview($this->row->id, $this->limitstart);?>
    and replace with:
    <?php
      global $mosConfig_absolute_path;
      $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
      if (file_exists($comments)) {
        require_once($comments);
     
        echo JComments::showComments($this->row->id, 'com_linkdirectory', $this->row->title);
      }
    ?>
  9. Find and delete the line #
    <a href="‍#action" name="action"><?php echo _LD_USER_COMMENTS;?> (<?php echo $this->row->comment;?>)</a>

See also:

 
JoomlaTune