Forums

More fields in joomla registration

Prova2 29 Sep, 2011
Hey guys!
Very very good component here, congratz!

This is my question: How can i add more custom fields in a registration form with chronoforms and save them in a database table?

Thank you in advance!
GreyHead 29 Sep, 2011
Hi Prova2,

Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.

Bob
Prova2 30 Sep, 2011
Hey GreyHead thanks for your quick reply!
Version i'm using is Chronoforms 4.0 and Joomla 1.5.23
GreyHead 05 Oct, 2011
Hi Prova2,

We don't yet have a tutorial for doing this in ChronoForms v4. (There is one for ChronoForms v3 on my site at greyhead.net).

You need to set up a separate table for the extra data including a 'user_id' column for the User ID.

Add a Custom Code action after the Joomla! Registration action and add this code
<?php
$form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']->id;
?>


After this add a DB Save action linked to your new table.

Note: not tested and will need debugging.

Bob
aardvark 16 Oct, 2011
Hi Bob

I've been fiddling around with this problem for a while - getting a null result from $form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']->id;

I think its because the registration action doesn't actually log you in, so you're still logged out (ie with id not set) while you're going through follow-on registration forms.

I'm trying to get the following to work - basically retrieving users email from Data->Session, then querying jos_users on it to get the joomla id key. Still no joy : can you spot my error or suggest a better method please ?

Thanks, Steve
$emailsess = $form->data[email];   //this bit works fine - $emailsess is actual email address

$db =& JFactory::getDBO();
$query = "SELECT * from jos_users WHERE email = ".$emailsess;

$db->setQuery($query);

$result = $db->loadRow();
$result2 = $result['0'];
aardvark 16 Oct, 2011
Update - sorted. ~Had to quote the email string :

<?php

$emailsess = "'".$form->data[inp_email]."'";

$db =& JFactory::getDBO();
$query = "SELECT * from jos_users WHERE email = ".$emailsess;

$db->setQuery($query);

$result = $db->loadRow();
$result2 = $result['0'];

$form->data[user_id] = $result2;
?>
This topic is locked and no more replies can be posted.