Page 1 of 1
Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 12:11
by chokens86
Hi,
I would like to know if anybody here knows how to filter the number of downloads for every user in a particular category in phoca. I appreciated help and suggestions.
Thanks
chok
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 12:40
by SonRiab
To make it a more clearer:
You want a statistic displaying which (registered) user downloaded how many in a specific category?
I think Phoca Download does not track downloads per user (witout looking at the code!

).
I think it is possible, but not implemented. So you have to code it youself.
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 18:13
by chokens86
Hi SonRiab,
Thanks for the reply, actually what I wanted to happen is that, once the user logged in, they can see their downloads. And for example, there will be 5 images for an instance, there will only be 2 images that they can choose to download among the five. Either of the 5 but limited to 2 downloads only. Is that possible to phoca?
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 20:23
by SonRiab
As far as I can say from the code:
PD can track the number of user-downloads per file
but there is no possibility to block downloads for users who reached a limit.
PD checks only if the user has access rights to the category.
So it is possible to view the number of downloads per user! (see Components->Phoca Download->Files->User Statistic)
Blocking downloads should also be possible but you must code it by yourself.
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 20:46
by chokens86
Can you give me some idea on how to code the blocking of downloads per category?
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 21:34
by SonRiab
The important part is the sql query which could look like that (just an example!!!) :
SELECT SUM(`count`) FROM `jos_phocadownload_user_stat`, `jos_phocadownload` WHERE `fileid`=`jos_phocadownload`.`id` AND `jos_phocadownload`.`catid`={category id} AND `userid`={user id}
Now you have the number of user-downloads in the category so you can decide if the user is allowed to download or not.
I am not sure where is the best place to insert this query and the check!
Maybe the query should be insert as a new function to phocadownload.php in the components/com_phocadownload/helpers folder and the rest in the default.php located in components/com_phocadownload/views/category.
But I am not willing to code this hack at the moment and I do not want to give further instructions to code it!
Thx for your understanding.
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 21:35
by chokens86

I barely need help on this. Hope you could help me.

Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 22:19
by SonRiab
Sorry but other things have a higher priority at the moment! So I have not the time for hacking this!
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 07 Jun 2011, 23:17
by chokens86
SonRiab,
Thanks for that info you gave me. I will try to find ways to insert that code to where it would be.
I appreciate your help a lot.
Re: Filter the of Downloads for every user in phoca dowloads
Posted: 06 May 2013, 22:45
by sethwcaton
I have a similar request, in that I want the Super Administrator in the backend to be able to choose a user and see a list of all files that user has downloaded. If this isn't already a feature somehow, it would be a welcome addition.
From the looks of it, one could write a query that would run and show all files a user has downloaded. I know almost nothing about writing the PHP code needed to run the query, but perhaps there's a Joomla extension for running simple queries like that?
If you would, please respond to my original post about this with perhaps a sample query that could do what I'd like to do:
viewtopic.php?f=31&t=23305