Thanks John!

While your example didn't exactly work it did help me figure out what
to do.

function addfriend($id = null) {
                if (!empty($this->data)) {
                        // set user id
                        $this->data['user_id'] = $this->Auth->user('id');
                        // add friend id here to make more secure
                        if ($this->User->UsersUser->save($this->data)) {
                                //debug($this->data);exit;

                                $this->Session->setFlash(__('The User has been 
saved', true));
                                $this->redirect($this->referer());

                        } else {
                                $this->Session->setFlash(__('The User could not 
be saved. Please,
try again.', true));
                                debug($this->data);exit;
                        }
                }
        }

I still am using a hidden form field in the view that passes the
friend_id
<input name="data[friend_id]" type="hidden" value="<?php echo
$user['User']['id']; ?>" id="friend_id" />

I know that is not secure and I shouldn't show the users ID anywhere
but I cant seem to figure out how to grab it from the session.

Thanks for all your help.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to