Unlogical code

aemkey
Phoca Member
Phoca Member
Posts: 12
Joined: 23 Jun 2011, 13:43

Unlogical code

Post by aemkey »

Hi there
I just tried to change the standard access level, when a user creates a new category in the frontend.
So I found some code, which doesn't make sense to me:

In controllers/user.php are the standard values set:
// Set default values
$post['access'] = 0;
//$post['access'] = 1;
$post['parent_id'] = 0;
$post['image_position'] = 'left';
$post['published'] = 1;
$post['accessuserid'] = '-1';
$post['uploaduserid'] = $this->_user->id;
$post['deleteuserid'] = $this->_user->id;
$post['userfolder'] = $this->_userFolder;
$post['owner_id'] = $this->_user->id;
Here I tried to change the access level, but nothing happend. It took me a while to find, that the accesslevel is set again in models/user.php

Code: Select all

function store($data) {
		
		if ($data['alias'] == '') {
			$data['alias'] = $data['title'];
		}
		$data['alias'] 	= PhocaGalleryText::getAliasName($data['alias']);
		$data['access']	= 1;
It doesn't really make sense to me to set this again, especially because the funtion is called right afterwards.
I've change it now for me, but probably it helps other people.
Or it would be a good thing to integrate it in the settings directly. If I find the time, Il will try to write it.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48345
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Unlogical code

Post by Jan »

Hi, thank you for the info, there were removed some pieces of code so not all was removed, I will fix it (for now it has no influence on the function)

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