Chronoform 4.0 RC3.5.2 and Joomla 2.5.4
Hi,
i created a form for the joomla user registration and it's working right.
Because i wanted to add extra fields to the user i created new table (user_details) in the DB and a new form (account_form)
to manage this user_details with record_loader and Update query. And it's working too (loading and saving)
I wish, from the registration form, after the on succes event of the joomla_registration_plugin,
to create a new empty record in my new table (users_details) to be able to update it form the account_form.
I put a 'Custom code Element' in the registraion form with the following code, but it's not working 'cause
i'm not able to get back the last registered user_id from the registration plugin.
Here's my custom code:
The update fails and i never have my new record in the #__user_details table.
Any ideas?
In the REgistration Fomr I have these elements On Submit
1) Debugger
2)Joomla User Registration
3)Custom Cose - Insert New Empty Record
4)Email
5)Thanks Message
Thanks in advance
M
Hi,
i created a form for the joomla user registration and it's working right.
Because i wanted to add extra fields to the user i created new table (user_details) in the DB and a new form (account_form)
to manage this user_details with record_loader and Update query. And it's working too (loading and saving)
I wish, from the registration form, after the on succes event of the joomla_registration_plugin,
to create a new empty record in my new table (users_details) to be able to update it form the account_form.
I put a 'Custom code Element' in the registraion form with the following code, but it's not working 'cause
i'm not able to get back the last registered user_id from the registration plugin.
Here's my custom code:
<?php
$user_id = $form->data['_PLUGINS_']['joomla_registration']->id;
echo $user_id;
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Insert columns.
$columns = array('input_user_id', 'input_nome', 'input_cognome', 'input_ragione', 'input_piva', 'input_indirizzo_fat', input_'citta_fat', 'input_provincia_fat', 'input_cap_fat', 'input_telefono');
// Insert values.
$values = array($user_id, $db->quote(''), $db->quote(''), $db->quote(''), $db->quote(''), $db->quote(''), $db->quote(''), $db->quote(''), $db->quote(''), $db->quote(''));
// Prepare the insert query.
$query
->insert($db->quoteName('#__user_details'))
->columns($db->quoteName($columns))
->values(implode(',', $values));
// Reset the query using our newly populated query object.
$db->setQuery($query);
try {
// Execute the query in Joomla 2.5.
$result = $db->query();
} catch (Exception $e) {
// catch any database errors.
echo 'Something WRONG'
}
?>
The update fails and i never have my new record in the #__user_details table.
Any ideas?
In the REgistration Fomr I have these elements On Submit
1) Debugger
2)Joomla User Registration
3)Custom Cose - Insert New Empty Record
4)Email
5)Thanks Message
Thanks in advance
M