Got no love from that... tried changing up to

function delete($id = null) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid id for post', 
true));
                        $this->redirect(array('action'=>'index'));
                }
                if($this->Session->read('Auth.User.id') == $this->Post->user_id 
) { // HERE
                if ($this->Post->delete($id)) {
                        $this->Session->setFlash(__('Post deleted', true));
                        $this->redirect(array('action'=>'index'));
                }
        }
                $this->Session->setFlash(__('Post was not deleted', true));
                $this->redirect(array('action' => 'index'));
        }

Now only get error: Undefined property: Post::$user_id
[APP/controllers/posts_controller.php, line 74]

What is the delete function needing to get Post info?






On Tue, Dec 7, 2010 at 9:31 AM, euromark <[email protected]> wrote:
> *LOL*
> well, sometimes even PHP is case sensitive
>
> try User and PostUser
>
>
> On 7 Dez., 14:26, Steve Mallett <[email protected]> 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 [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
>



-- 
Steve Mallett
inevitable.cc (the) Inevitable Corp.

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

Reply via email to