Forums

sending group_id to database table

tamirster 08 Oct, 2011
hello,
i found this joomla! extension very useful!

however i couldn't figure out one thing: i am trying to create a form in which every customer will answer a survey.
i need to send the group id to the database. the default option is sending user id, but i need the group id as well to analyze forms based on customer groups...

is there any way to add the group id to the data that is being sent to DB? can anyone guide me through it?

thanks for any help in advance!!!
GreyHead 09 Oct, 2011
Hi tamirster,

If you have the User ID you can always look their group id.

If you want to add it then add a 'user_gid' column to your table and use this code:
<?php
$user =& JFactory::getUser();
// uncomment the next line for ChronoForms v3
//JRequest::setVar('user_gid', $user->gid);
// uncomment the next line for ChronoForms v4
//$form->data['user_gid'] = $user->gid;
?>

The code goes in the On Submit Before box in CFv3 or a Custom Code action before the DB Save action in CFv4
Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}