News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Jcomments 3.0.5 - Wrong Plugin Code for JD 3.x.x - Workaround - [Solution inkl.]

Started by Nyx, 21.05.2015 13:49:03

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nyx

Hi,

the Jcomments 3.0.5 [01/08/2014] - is working with the new JD 3.x.x BUT the Comment Links / URL are wrong.


A little Workaround:

I will post here the code, that working for me (with SEF URLS) - The JComments Forum ist dead /only Spammer posts.

You must change the: /components/com_jcomments/plugins/com_jdownloads.plugin.php

old code:

<?php
/**
 * JComments plugin for JDownloads objects support
 *
 * @version 2.3
 * @package JComments
 * @author Sergey M. Litvinov (smart@joomlatune.ru)
 * @copyright (C) 2006-2013 by Sergey M. Litvinov (http://www.joomlatune.ru)
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 */

defined('_JEXEC') or die;

class 
jc_com_jdownloads extends JCommentsPlugin
{
function getObjectInfo($id$language null)
{
$db JFactory::getDBO();
$query "SELECT file_id as id, file_title as title, submitted_by as owner, cat_id"
" FROM #__jdownloads_files"
" WHERE file_id = " $id;
$db->setQuery($query);
$row $db->loadObject();

$info = new JCommentsObjectInfo();

if (!empty($row)) {
$db->setQuery("SELECT id FROM #__menu WHERE link = 'index.php?option=com_jdownloads&view=viewcategory&catid=".$row->cat_id."' and published = 1");
$Itemid $db->loadResult();

if (!$Itemid) {
$Itemid self::getItemid('com_jdownloads');
}

$Itemid $Itemid '&amp;Itemid='.$Itemid '';

$info->category_id $row->cat_id;
$info->title $row->title;
$info->userid $row->owner;
$info->link JRoute::_('index.php?option=com_jdownloads'.$Itemid.'&amp;view=viewdownload&amp;catid='.$row->cat_id.'&amp;cid='.$id);
}

return $info;
}
}


new code for SEF URLs

<?php
/**
 * JComments plugin for JDownloads objects support
 *
 * @version 2.3
 * @package JComments
 * @author Sergey M. Litvinov (smart@joomlatune.ru)
 * @copyright (C) 2006-2013 by Sergey M. Litvinov (http://www.joomlatune.ru)
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 */

defined('_JEXEC') or die;

class 
jc_com_jdownloads extends JCommentsPlugin
{
function getObjectInfo($id$language null)
{
$db JFactory::getDBO();
$query "SELECT file_id as id, file_title as title, submitted_by as owner, cat_id"
" FROM #__jdownloads_files"
" WHERE file_id = " $id;
$db->setQuery($query);
$row $db->loadObject();

$info = new JCommentsObjectInfo();

if (!empty($row)) {
$db->setQuery("SELECT id FROM #__menu WHERE link = 'index.php?option=com_jdownloads&view=category&cat_id=".$row->cat_id."' and published = 1");
$Itemid $db->loadResult();

if (!$Itemid) {
$Itemid self::getItemid('com_jdownloads');
}

$Itemid $Itemid '&Itemid='.$Itemid '';

$info->category_id $row->cat_id;
$info->title $row->title;
$info->userid $row->owner;
$info->link JRoute::_('/download/'.$row->cat_id.'/'.$id);
}

return $info;
}
}


Now make a refresh of the Comments i the joomla admin Interface:
component -> jcomments -> comments -> "Refresh Objects"

  •  

Arno

Hi Nyx,
i have the plugin reworked a little bit.
Please try the unzipped file below and post here your result.

When it is okay i will inform the developer from jcomments.  ;)


[gelöscht durch Administrator]
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Nyx

Hi Arno,

sorry for my late answer.

I have tested it, it looks very good.
The urls are now better ;-)

Then forget my "Russian version"  ;D
  •  

Arno

Hi,
thanks for your result.
I have contacted the jcomments developer.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •