A hidden field could accomplish exactly what you are looking to do.
$form->input('User.user_id', array('type' => 'hidden', 'value' =>
$this->Session->read('Auth.User.id'));
The user id will accessible in your controller through $this->data
HTH
On Wed, Feb 2, 2011 at 12:53 PM, 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]<cake-php%[email protected]>For
> more options, visit this group at
> http://groups.google.com/group/cake-php
>
--
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