0 Members and 1 Guest are viewing this topic.

CSS based on ACL
« on: 13.04.2022 07:04:48 »
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. 
Code: [Select]
<img src=/images/jdownloads/access/{access}.png>
So these are the 3 files I modify to achieve this:
Code: [Select]

## 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,