User upload pre select category

Phoca Download - download manager
JohnD
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 03 Jul 2019, 19:36

User upload pre select category

Post by JohnD »

Hi,
when i create an user upload page in the frontend,i see a message " Please select category to be able to upload files". Is it possible to have the category already selected and get rid of the alert message? I want to have one categorie per user. Any help is appreciated.
JohnD
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 03 Jul 2019, 19:36

Re: User upload pre select category

Post by JohnD »

I got a solution, which is probably very 'hacky' and not update safe:
In the file: \administrator\components\com_phocadownload\libraries\phocadownload\category\category.php

i deleted the first select option of the dropdown:

/*$categories[] = JHTML::_('select.option', '0', '- '.JText::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -');*/
$categories = [];

and wrote a function that returns the actual catid which you need to set in the \components\com_phocadownload\views\user\tmpl\default_files_bootstrap.php file in order to get rid of the alert message.

My idea was to have the user uploads seperated into different (category) folders. If there is a official way how to do this or if you know how write a proper overwrite of this component let me know.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48550
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: User upload pre select category

Post by Jan »

Hi, there is no other way for now. You should only be aware what happened when there is no category or when there is more than one category (one will be automatically selected which can be confused)

Jan
If you find Phoca extensions useful, please support the project
Post Reply