JComments

Integration of JComments to HotOrNot2 gallery

HotOrNot2 —image gallery component for Joomla with support of rates and votes.The offered to your attention integration is inteneded to replace the built-in comment system by JComments.

  1. Open file /components/com_hotornot2/displaypix.html.php
  2. Find the lines:
    displayComments($pic);
    displayCommentForm($picid);
    and replace with:
    if ($conf->get('commenting') == 1) {
      if ($uid != 0 || $conf->get('allow_anonymous_comments') == 1) {
     
          global $mosConfig_absolute_path;
          $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
          if (file_exists($comments)) {
            require_once($comments);
            $obj_id = $picid;
            $obj_title = $pic->getTitle();
            echo JComments::showComments($obj_id, 'com_hotornot2', $obj_title);
          }
      }
    }
  3. Open file /components/com_hotornot2/hotornot.picture.php
  4. Find the line:
      $query = "SELECT id, username, comment, UNIX_TIMESTAMP(date) AS date, published 
    and replace with:
    /*
      $query = "SELECT id, username, comment, UNIX_TIMESTAMP(date) AS date, published 
  5. Find the lines:
          array_push($this->comments, new hot_comment($username,$r->comment, $r->date, $r->published));
          }
        }
    and replace with:
          array_push($this->comments, new hot_comment($username,$r->comment, $r->date, $r->published));
          }
        } 
    */
  6. Open file /components/com_hotornot2/hotornot2.php
  7. Find the lines:
      $query = "DELETE FROM #__hotornot_comments WHERE idx = '$id'";
      $database->setQuery($query);
      $result = $database->query();
      if ($database->getErrorNum() && $conf->get('debug_mode') == 1)
        echo '<p /><small><b>DB Error:</b> '.$database->stderr(TRUE).'</small>';
    and replace with:
          global $mosConfig_absolute_path;
          $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
          if (file_exists($comments)) {
            require_once($comments);
            JComments::deleteComments($id, 'com_hotornot2');
          }
  8. Find the lines:
    $query = "SELECT count(*) AS count
        FROM #__hotornot_comments
        WHERE username='$uid'";
    $database->setQuery($query);
    $result = $database->loadObjectlist();
    if ($database->getErrorNum() && $conf->get('debug_mode') == 1)
      echo '<p /><small><b>DB Error:</b> '.$database->stderr(TRUE).'</small>';
     
    $comments = $result[0]->count;
    and replace with:
    $query = "SELECT count(*) AS count
        FROM #__jcomments
        WHERE object_group = 'com_hotornot2' AND userid=$uid";
    $database->setQuery($query);
    $comments = $database->loadResult();
  9. Open file /administrator/components/com_hotornot2/admin.hotornot2.php
  10. Find the lines:
      case "showcomments":
        showcomments($option);
    and replace with:
      case "showcomments":
     
          global $mosConfig_absolute_path;
          $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
          if (file_exists($comments)) {
            require_once($comments);
            mosRedirect( 'index2.php?option=com_jcomments&task=view&fog=com_hotornot2' );
          } else { showcomments($option); }

See also:

 
JoomlaTune