Page 1 of 1

how do I get id of a user who compiled a form?

Posted: Sun Nov 18, 2007 11:00 am
by Chrx74
Hello. I want to put a form on my ws. I don't want the user to insert his id info manually .. since if you are logged in there should be a way to get this information ... what do I need to write in my code to get the id of the user that compiled the form?
Thanks

Re: how do I get id of a user who compiled a form?

Posted: Tue Nov 20, 2007 4:54 pm
by wes_517
I did it this way in my component i'm working on

Code: Select all

$user =& JFactory::getUser();
      if($user->id)
      {
         $row->user_id = $user->id;
      }

All i care about at the immediate moment is their ID, and getting that into a collection I called $row, so I set the $user variable, check to make sure there is an Id in it, and if so I put that ID into the $row->id with the other information.

Re: how do I get id of a user who compiled a form?

Posted: Tue Nov 20, 2007 5:46 pm
by Chrx74
thanks... anyway what is Jfactory?