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.
Hide Preview button based on file/user access level
-
- Phoca Newbie
- Posts: 8
- Joined: 22 Mar 2011, 14:05
- Jan
- Phoca Hero
- Posts: 48550
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Hide Preview button based on file/user access level
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
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
Jan
So this needs to be customized in the code, the rights which are applied to download, should be applied to all buttons

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

Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 6
- Joined: 10 May 2017, 19:09
Re: Hide Preview button based on file/user access level
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?
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?
- Jan
- Phoca Hero
- Posts: 48550
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Hide Preview button based on file/user access level
Hi, what you mean with "share the code"? I don't have any such code 

If you find Phoca extensions useful, please support the project