file unpublished but still visible in filelist view

Phoca Download - download manager
Easytherm
Phoca Member
Phoca Member
Posts: 11
Joined: 05 May 2011, 10:51
Location: Switzerland
Contact:

file unpublished but still visible in filelist view

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: file unpublished but still visible in filelist view

Post 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';
}
If you find Phoca extensions useful, please support the project
Easytherm
Phoca Member
Phoca Member
Posts: 11
Joined: 05 May 2011, 10:51
Location: Switzerland
Contact:

Re: file unpublished but still visible in filelist view

Post by Easytherm »

Than you Jan, appreciate your quick answer.

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

regards
Easytherm
Phoca Member
Phoca Member
Posts: 11
Joined: 05 May 2011, 10:51
Location: Switzerland
Contact:

Re: file unpublished but still visible in filelist view

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: file unpublished but still visible in filelist view

Post 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
If you find Phoca extensions useful, please support the project
Post Reply