Tuesday, December 7, 2010

Re: checking for owner & logged in ID are same

*LOL*
well, sometimes even PHP is case sensitive

try User and PostUser


On 7 Dez., 14:26, Steve Mallett <steve.mall...@gmail.com> wrote:
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate