restrict new category frontend

Phoca Gallery - image gallery extension
brianteeman
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 13 Aug 2009, 13:43

restrict new category frontend

Post by brianteeman »

I have a gallery with three parent categories 2007, 2008, 2009
There are no photos in those categories just sub-categories

I want to allow front-end registered users the ability to create their own category and upload images to the category. But this category must ONLY be created in the 2009 parent category

As far as I can see currently all front-end categories are created in the root and I would have to move them manualy to 2009/. Is that correct.

If that assumption is correct would it be possible insert the parent_id of the parentcategory 2009 in the create category function? (Any clues where?)
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
brianteeman
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 13 Aug 2009, 13:43

Re: restrict new category frontend

Post by brianteeman »

The more I think of it this will be an important need for many users of the gallery.

If you want to separate the site owners galleries from the user created galleries it would be so much nicer if user galleries were automaticaly created in a designated top level category.

I've had a quick look at the code and I'm sure it must be relatively easy to achieve for someone who understand the phoca code far better than me.
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: restrict new category frontend

Post by Jan »

Hi, for now theare are two types:

- rights for users: user can upload, delete, publish/unpublish images everywhere they get permissions
- creating category in front - user can create only one category in root (in the front).

The new UCP is planned, but there are a lot of problems they must be solved before (permissions, image sizes, folder sizes, automatically thumbnail creating, etc.)

So planned is: user will be able to create one parent category, then in this category he will be able to create subcategories (count will be limited in parameters, the same with size of all images)

Jan
If you find Phoca extensions useful, please support the project
brianteeman
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 13 Aug 2009, 13:43

Re: restrict new category frontend

Post by brianteeman »

Jan wrote: - creating category in front - user can create only one category in root (in the front).

So planned is: user will be able to create one parent category, then in this category he will be able to create subcategories (count will be limited in parameters, the same with size of all images)

Jan
So you dont have plans to do what i suggested and restrict user created category to one site created category.

Thats a real shame. guess i will just have to hack it myself then.
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: restrict new category frontend

Post by Jan »

Maybe I don't fully understand what you mean with: "restrict user created category to one site created category"?
If you find Phoca extensions useful, please support the project
brianteeman
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 13 Aug 2009, 13:43

Re: restrict new category frontend

Post by brianteeman »

OK Let me try and explain further.

The site owner creates 4 parent categories (parent_id=0)
1. Dogs (id=1, parent_id=0)
2. Cats (id=2, parent_id=0)
3. Birds (id=3, parent_id=0)
4. User Galleries (id=4, parent_id=0)

1,2,3 are all created and managed by the site owner but 4. is where all the user created galleries go

Currently, as far as I can tell, when a user (front-end) creates a gallery it is created at the top level (parent_id=0).

What I am suggesting is that there should be a method for the site owner to preselect the parent_id for all user created galleries. In this example this would be parent_id=4

Another example of usage would be
1. Dogs (id=1, parent_id=0)
2. Cats (id=2, parent_id=0)
3. Birds (id=3, parent_id=0)
4. Unpublished_to_be_checked (id=4, parent_id=0)

In this example the user created galleries would all be created in the "Unpublished_to_be_checked" category and can then be moved to 1,2,3 etc when checked by the site owner.

Does that make things clearer?
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49299
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: restrict new category frontend

Post by Jan »

yes, but doing this will take a lot of time because of different rights and changing the permissions from categories to users. Now the permissions are set to categories. So you can create a category with permissions and set it will be a category of user A. So user A has in fact the permissions of the category. But if there should be uploaded images of more users, there is problem then :-(
If you find Phoca extensions useful, please support the project
brianteeman
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 13 Aug 2009, 13:43

Re: restrict new category frontend

Post by brianteeman »

Surely it is as simple as changing the code for front end user create category to include a predefined parent_id?
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
ianballantine
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 20 Sep 2009, 16:33

Re: restrict new category frontend

Post by ianballantine »

Any progress on this yet?
It seems to me we need to find in the code where the user category is created. I presume this is in the views/user/view.html.php file but not too sure.
I would also presume that, automatically, the parent of this newly created category id is always '0' as this is the category id of the root - and always is. If we can find where this happens, we can just replace the zero with the category id number of the category we want these user galleries to be 'children' of.
As this will not be changing regularly, it is only necessary to modify the code in the php file - ie not go to the trouble of setting it as a variable with ability to set or change it in the backend.
Doing this should have absolutely no effect on anything to do with the category id of the user's category.

Let's not give up on this yet. Otherwise we would need to constantly monitor our sites so as to avoid, if nothing else, menus stretching as additional categories are created at the root level.

Thanks
ianballantine
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 20 Sep 2009, 16:33

Re: restrict new category frontend

Post by ianballantine »

Ok - SUCCESS!
Line 697 of controllers/category.php appears as:
$post['parent_id'] = 0;

Simply change the zero to the category id of the category you want to be the parent of all user created categories.

I have tested and appears to work fine.
Post Reply