jDownloadsownloads.com



Author Topic: Content Plugin subcategories/multiple categories  (Read 4236 times)

0 Members and 1 Guest are viewing this topic.

Offline idfake

  • Newbie
  • *
  • Posts: 7
Content Plugin subcategories/multiple categories
« on: 30.05.2014 10:07:11 »
Hi there,

i thought i'd share a little patch for the content plugin I made.
It allows to display multiple categories with
Code: [Select]
{jd_file category==1,2,3,4}I haven't tested it extensively, but it works for me.
The patch is against 2.0.10 of the plugin.


Code: [Select]
1461c1461
<         $database->setQuery("SELECT count(*) FROM #__jdownloads_cats WHERE published = 1 AND cat_id = '".$database->getEscaped($matches[2])."' AND (cat_access <= '$access' OR cat_group_access IN ($user_is_in_groups))");
---
>         $database->setQuery("SELECT count(*) FROM #__jdownloads_cats WHERE published = 1 AND cat_id IN (".$database->getEscaped($matches[2]).") AND (cat_access <= '$access' OR cat_group_access IN ($user_is_in_groups))");
1463c1463
<         $database->setQuery("SELECT count(*) FROM #__jdownloads_cats WHERE published = 1 AND cat_id = '".$database->getEscaped($matches[2])."' AND cat_access <= '$access'");
---
>         $database->setQuery("SELECT count(*) FROM #__jdownloads_cats WHERE published = 1 AND cat_id IN (".$database->getEscaped($matches[2]).") AND cat_access <= '$access'");
1469c1469
<            $database->setQuery("SELECT * FROM #__jdownloads_files WHERE published = 1 AND cat_id = '".$database->getEscaped($matches[2])."' ORDER BY downloads desc ".$count);
---
>            $database->setQuery("SELECT * FROM #__jdownloads_files WHERE published = 1 AND cat_id IN (".$database->getEscaped($matches[2]).") ORDER BY downloads desc ".$count);
1472c1472
<            $database->setQuery("SELECT * FROM #__jdownloads_files WHERE published = 1 AND cat_id = '".$database->getEscaped($matches[2])."' ORDER BY date_added desc ".$count);
---
>            $database->setQuery("SELECT * FROM #__jdownloads_files WHERE published = 1 AND cat_id IN (".$database->getEscaped($matches[2]).") ORDER BY date_added desc ".$count);
1475c1475
<            $database->setQuery("SELECT * FROM #__jdownloads_files WHERE published = 1 AND cat_id = '".$database->getEscaped($matches[2])."' ORDER BY ordering ".$count);
---
>            $database->setQuery("SELECT * FROM #__jdownloads_files WHERE published = 1 AND cat_id IN (".$database->getEscaped($matches[2]).") ORDER BY ordering ".$count);

Offline Arno

  • Administrator
  • ***
  • Posts: 12.234
    • jDownloads.com
Re: Content Plugin subcategories/multiple categories
« Reply #1 on: 04.06.2014 13:38:41 »
Hi,
many thanks.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!