dont use a hidden field
it can easily manipulated :)

if (!empty($this->data)) {
        $this->Product->create();
        $this->data['Product']['user_id'] = $this->Session-
>read('Auth.User.id');

        if ($this->Product->save($this->data)) {
                ...
        }
        ...
}

On 2 Feb., 18:53, Paul Wheatley <[email protected]> wrote:
> Hello,
>
> I have a add view that you have to be logged in to get to.
>
> What i am trying to do is add the UserID of the person creating the record to 
> the table so that later i can display only posts that relate to him/her.  I 
> have a field called user_id and sort of hoped that Cake would do a similar 
> thing to "created" and just fill it in but alas no.
>
> I think what i need to do is create a hidden field in my form thats value is 
> generated from the Auth session data but i am not sure how to go about it.
>
> Can anyone help?

-- 
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

Reply via email to