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
how do I get id of a user who compiled a form?
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Re: how do I get id of a user who compiled a form?
I did it this way in my component i'm working on
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.
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?
thanks... anyway what is Jfactory?