I'm working from the 1.3 blog & Acl tutorial.
in posts_controlllers.php I'm trying to add
if($this->user->id == $this->postUser->id ) { to the delete function
so anyone can't type in /posts/delete/postNumber to delete other's
posts like so:
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for post',
true));
$this->redirect(array('action'=>'index'));
}
if($this->user->id == $this->postUser->id ) { //// HERE
if ($this->Post->delete($id)) {
$this->Session->setFlash(__('Post deleted', true));
$this->redirect(array('action'=>'index'));
}
}
then I get:
Notice (8): Undefined property: PostsController::$user
[APP/controllers/posts_controller.php, line 81]
Thanks in advance,
--
Steve
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en