I was just trying this, but it says Undefined variable: id [APP/
Controller/UsersController.php, line 71]
But line 71 being $id = $this->isEditable($id);
It should be defined ?
Full code for help :
private function isEditable($id) {
if ($this->Auth->user('role') == 'admin') {
// if they are admin, so return the original id they
wanted to
edit
return $id;
}
// if they are not admin, so return their user id
return $this->Auth->user('id');
}
public function isAuthorized($user) {
if (parent::isAuthorized($user)) {
return true;
}
if ($this->action === 'edit') {
$id = $this->isEditable($id);
if ($this->Auth->user('id') == $id) {
return true;
}
}
return false;
}
On 16 jan, 18:37, jeremyharris <[email protected]> wrote:
> The stack traces are there to help you. It says it's missing the argument,
> which means you're not passing it. It's called on line 71, which will show
> you where you called the function without passing the argument.
>
> $id = $this->isEditable(); // no argument $id passed to the function
> isEditable()
> $id = $this->isEditable($id); // now you're passing the argument
>
> Stack traces are your friend :)
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php