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

CSS based on ACL

Started by isabeaux, 13.04.2022 07:04:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

isabeaux

Hello,
I've been using JDownloads for many years and it has been a workhorse. Thank you for all the work.

I have been patching the code on every update to suit my needs, but I though I'd request the modification, as there might be others that may want this feature.

In my setup, I need to use different colors depending on the ACL of the file. I have 3 access levels, Registered, Silver & Gold in corresponding hierarchy. Within the same category, there will be files for these 3 ACLs. I can't separate them into new categories, as these files are time based and they "roll" through the access levels. i.e. with new files available every month, Gold sees them right away, after 6 months, I change the ACL to Silver (covers Silver & Gold), and in a year they are down to Registered -visible to all. Hence Gold gets the files right away, Silver waits 6 months and Registered gets it all if they stick around for a year.
It is important to me that when a user upgrades to Silver or Gold, they can see the newly available files right away as they are in the category's color. This way they see right away what they got for the upgrade. This could be done if they were in different categories, but by rolling them within the category I have no issues with broken links and it simplifies my structure.

What I need (and I've added to my code) is the substitution for {access} . With it, by inserting it in the layouts, I can do many different things, custom colors, pictures. i.e.  <img src=/images/jdownloads/access/{access}.png>

So these are the 3 files I modify to achieve this:


## in file components/com_jdownloads/views/download/tmpl/default.php
   #After: $body = str_replace('{file_title}', $item->title.' '.$editIcon, $body);
   #Add line 488
        $body = str_replace('{access}', $item->access, $body);

## in file components/com_jdownloads/views/category/tmpl/default.php
   #After: $html_file = str_replace('{file_title}',$download_link_text, $html_file);
   #Add line 1497
$html_file = str_replace('{access}', $files[$i]->access, $html_file);

## in file components/com_jdownloads/views/categories/tmpl/default.php
   #After: $html_cat = str_replace('{cat_pic}', $catpic, $html_cat);
   #Add line 432
$html_cat = str_replace('{access}', $cats[$i]->access, $html_cat);



If this gets implemented in future versions it will make me happy.
Thank you,
Tomás
  •