Forums

attaching user_id as a hidden field

tomluong 12 Nov, 2009
Hi all,
First off, let me say this is my first time using ChronoForm and it is a great piece of software.

Does any know of a good tutorial on how I could attached a members user_id to a form as a hidden field. I know it probably has something to do with adding the plugins, but I am still confused on how to use them and exactly what they do from reading the tutorials.

Thanks,
Tom
nml375 12 Nov, 2009
Hi Tom,
Actually, adding the User ID of the currently logged user is a "trivial" as adding this piece of PHP-code to your form:
<?php
$user =& JFactory::getUser();
echo '<input type="hidden" name="user_id" value="' . $user->id . '" />';
?>


/Fredrik
tomluong 12 Nov, 2009
thanks,
it worked great.
This topic is locked and no more replies can be posted.