Oh okay. Thank you very much. I had tried the second way that you mentioned, but for some I thought it had to be user('user_id') rather than user('id'). id makes more sense.
Thank you On Aug 20, 12:32 pm, cricket <zijn.digi...@gmail.com> wrote: > On Wed, Aug 18, 2010 at 4:04 PM, Rob <bizarro...@gmail.com> wrote: > > Hey, this is my first time using google groups (im used to forums) so > > if this post is in the wrong are or something let me know. > > > I have a cake php application and I'm using auth, acl, groups and all > > that jazz for users. I have users being able to post content, but I'm > > having a problem finding out how to link the user to that content. > > Right now whenever a user posts something the user_id shows up as 0 in > > the database. I'm pretty sure all my relationships are correct in my > > models. I've tried making a hidden field in the my add.ctp view, but > > I'm not having any luck. > > > Any help is appreciated, and if you need more info let me know. > > What does the hidden field look like? It should be: > > $form->hidden('Post.user_id', array('value' => > $session->read('Auth.User.id'))) > > Alternatively (and also more secure), you can leave out the hidden > field and add the value to the data array in the controller before > saving. > > $this->data['Post']['user_id'] = $this->Auth->user('id'); 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