Page 1 of 1

file unpublished but still visible in filelist view

Posted: 20 Aug 2013, 08:18
by Easytherm
Hello,
in my teacher's website, i use phocadownload to give download access to lectures to my students.

files are bound to a download category. in the frontend's article i show a filelist using phoca download file plugin, for example this :
{phocadownload view=filelist|id=29}
the whole system works fine and i'm very happy with it

Now my question:
we begin now a new school year, and I need to hide some files from this list (i will enable them later during the year, as needed).
So i simply tried to unpublish the file in phoca download administration.
From the front end, the filename is still visible, but the file cannot be downloaded with message "You have no rights to access file in this category"
if, in total, 10 files are to be downloaded (at the end of the year) and only 2 can be downloaded now (begin of year), the user gets unsure, because he/her can't see which file are accessible and which are not.


=> Is it possible to hide the file from the filelist, so the user cannot see it?
My workaround was to change the category of this file but it is a little complicate and hides the files from the backend's filtered view
Do you have any suggestion?

regards
Jacques

Re: file unpublished but still visible in filelist view

Posted: 21 Aug 2013, 13:17
by Jan
Hi, such way the component is working - it means, in component you can do this. In Plugin you need to customize the plugin PHP code to not load the inaccessible files :idea:

Find this code in plugin:

Code: Select all

if ((int)$id > 0) {
   $query .= ' WHERE c.id = '.(int)$id;
}
and replace it with:

Code: Select all

if ((int)$id > 0) {
   //$query .= ' WHERE c.id = '.(int)$id;
   $query .= ' WHERE c.id = '.(int)$id . ' AND a.published = 1 AND a.approved = 1';
} else {
   $query .= ' WHERE a.published = 1 AND a.approved = 1';
}

Re: file unpublished but still visible in filelist view

Posted: 21 Aug 2013, 13:22
by Easytherm
Than you Jan, appreciate your quick answer.

I wil try this later this week and give feed-back

regards

Re: file unpublished but still visible in filelist view

Posted: 25 Aug 2013, 12:09
by Easytherm
Tried it. It works (of course), thank you very much for your help. Well worth a donation. searching for paypal link now...

Why dont make this behaviour as standard (not showing unpublished files) ?

regards

Jacques

Re: file unpublished but still visible in filelist view

Posted: 29 Aug 2013, 14:28
by Jan
Hi,
Why dont make this behaviour as standard (not showing unpublished files) ?
Because it is not defined, if user wants to display the files or not. Many users want to display the files and while clicking on download the login will be displayed. Many want to not have it displayed. :-(

Jan