Definately go with euromark's answer, Ed is correct in his, but like he says
it can be manipulated (just for emphasis)

On 2 February 2011 18:07, Ed Propsner <[email protected]> wrote:

> I'd go with euromark's answer :) He's right about the field being easily
> manipulated.
>
>
> On Wed, Feb 2, 2011 at 1:03 PM, Ed Propsner <[email protected]> wrote:
>
>> 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]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>



-- 
Kind Regards
 Stephen @ NinjaCoderMonkey

 www.ninjacodermonkey.co.uk

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