News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

Ability to customize CSS based on file's access level - [Added in 4.0.35]

Started by isabeaux, 29.09.2023 04:11:11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

isabeaux

Hello,
First I want to express my gratitude for the ease in migrating to J4. I just finished doing all my testing with JD, which I have heavily customized with CSS, and moving to J4 didn't' require much adjustment to the CSS code. Given that J4 has substantially changed it's structure, and all the re-writing I had to do for other extensions, the easy migration for JD is a small miracle. Thank you.

The only customization I do to the code, is to insert a replacement value of {access}, making the layout return the access level for that category and/or file. This helps me immensely given that I'm always adding files about twice monthly, and my tiered membership has access to files basically on how old they are. As an example, regular members have access to files that are over a year old, gold membership has access to all files up to the latest, and a couple more tiers in-between. As this is a "rolling" setup, where every year I change the access levels of some files from gold to regular, files with different ACL sit in the same category. I could use sub-categories, but then when I change them from sub-category the links would change (I use a forum with links to them as extra reminders when they are posted), and a couple other minor issues.

With this new replacement {access} I can "paint" the gold files 'gold' and it also points out to those Gold members what they are getting for their money easily and unmistakably. In the layouts I add something like class="{access}" and I can go to town with CSS.

To achieve this, I've added a line of code to 3 files. There might be need to add more, but this was enough for my needs. With every update, I make these changes again and I thought I'd requested as a new feature as there might be others like me who would want this.

My changes are:


1 ## in file components/com_jdownloads/tmpl/download/default.php

#Add line 489 After: $body = str_replace('{file_title}', $item->title.' '.$editIcon, $body);
New line:
        $body = str_replace('{access}', $item->access, $body);

2 ## in file components/com_jdownloads/tmpl/category/default.php

#Add line 1573 After: $html_file = str_replace('{file_title}',$download_link_text, $html_file);
New line:
$html_file = str_replace('{access}', $files[$i]->access, $html_file);

3 ## in file components/com_jdownloads/tmpl/categories/default.php

#Add line 453 after: $html_cat = str_replace('{cat_pic}', $catpic, $html_cat);
New line:
$html_cat = str_replace('{access}', $cats[$i]->access, $html_cat);


I'd be very happy if this would be considered as a new feature to a future upgrade.
Thank you,
Tomás
  •  

ColinM

Tomás,
If this were to be done perhaps a better way would be to directly support {access} in the layouts - and also {access_title} so it could be reported.  Presently we are considering revising the layout structure to be more like a 'template' or similar.
Our priority at the moment is of course to 'shake out' any remaining bugs in jD4 series

Colin
Colin M
  •  


Arno

Is now a part from version 4.0.35 and is coming very soon. ;)
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Arno

I have now deactivated the adjustment (marked as a comment).
At first was only the ID value displayed here.
I had extended this so that the respective user group is displayed instead. See example pics.

But actually the use of this placeholder is only useful to a limited extent.
For users who do not belong to the required user group, such categories or downloads are not displayed at all.
They cannot see which user group they need to access them.

So this is only useful for administrators who want to check the frontend for this.  ::)
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Arno

I will this new placeholder now add as described above, For the frontend types: Categories, Category, Downloads, Download, MyDownloads.
But the restrictions which I had descrtibed above are still existent.

So this actually only makes sense if administrators (or others with the appropriate rights) want to check the view permissions in the frontend.

Therefore, I have now extended this to the overall view of all categories. See pic.

However, it would perhaps make much more sense to display more detailed information about the download permissions. After all, these are independent of the view permission. However, since users can belong to several user groups, such a display would not be quite so simple to implement. Perhaps I will try to implement this in a later version. At the moment, other issues are even more important.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

isabeaux

That is fantastic news, thank you!
Not just for moderators, but as I described above, it's very useful for my members, as they advance in the tiers and can always see what is in a lower ACL.
Tomás
  •