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

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
Chrx74
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Nov 02, 2007 10:00 am

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

Post by Chrx74 » Sun Nov 18, 2007 11:00 am

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

wes_517
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Aug 20, 2007 7:43 pm

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

Post by wes_517 » Tue Nov 20, 2007 4:54 pm

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.

Chrx74
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Nov 02, 2007 10:00 am

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

Post by Chrx74 » Tue Nov 20, 2007 5:46 pm

thanks... anyway what is Jfactory?


Post Reply