Hide Preview button based on file/user access level

Phoca Download - download manager
cholzsch
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 22 Mar 2011, 14:05

Hide Preview button based on file/user access level

Post by cholzsch »

I'm looking for a way to hide the "Preview" button from the files view, based on the usergroup permissions of the original file, or request user login before previewing. In other words, if the "Display Inaccessible Files" option is set to Yes on an image file (so user can see file name and that image is available) and user clicks on "Preview" in files view, it brings up a "Please login to preview the file", similar to what happens when user clicks on "Download" in same view. A model window opens, "Please login to download the file".

A simple way to hide ALL buttons (Preview, Details, Download, etc.) based on file access level vs. user access level might be easier.

Thanks for your input.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Hide Preview button based on file/user access level

Post by Jan »

Hi, there is no such option, normally it works the reverse way, you display in previews only partial documents and when users want to download it, they should login.

So this needs to be customized in the code, the rights which are applied to download, should be applied to all buttons :idea:

so you should look at the models where the data are loaded from database (to change the sql query) and the views (view.html.php) to see the access rights code and modify it to the previews :idea:

Jan
If you find Phoca extensions useful, please support the project
Brandon-aaws
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 10 May 2017, 19:09

Re: Hide Preview button based on file/user access level

Post by Brandon-aaws »

Hello,

Can you please share the code that will required to have preview button show on the page but will redirect to login page like download when set to registered user or another user group?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Hide Preview button based on file/user access level

Post by Jan »

Hi, what you mean with "share the code"? I don't have any such code :idea:
If you find Phoca extensions useful, please support the project
Post Reply