Hi,
I'm using Chronoform for new user registration and that is working fine. In my registration form, I have few additional fields on top of the Joomla standard fields, and I'm saving all the information except for the password to a chronoform_data table as well.
Now, I want to create a page for users to update their profile information, both joomla and custom fields. I'm a bit confused as can I load the user's profile in the form.
Here is what I have so far:
A- Update form with the same fields as registration + old-password field for password update.
B- In Events I have the following:
1- Custom code which is:
2- DB Record Loader:
DB FIeld: cf_uid
Table: my chronoforms_data
Request Param: user_id
Load Fields: Yes
Curly Replacer: No
Model ID: -
Load Under Model ID: No
Advanced Tab: all blank
3- Show HTML
Based on the above setting my form is not loading the data. I'm not sure what I'm doing wrong.
Thanks in advance.
I'm using Chronoform for new user registration and that is working fine. In my registration form, I have few additional fields on top of the Joomla standard fields, and I'm saving all the information except for the password to a chronoform_data table as well.
Now, I want to create a page for users to update their profile information, both joomla and custom fields. I'm a bit confused as can I load the user's profile in the form.
Here is what I have so far:
A- Update form with the same fields as registration + old-password field for password update.
B- In Events I have the following:
1- Custom code which is:
<?php
$user =& JFactory::getUser();
$form->data['user_id'] = $user->id;
?>
2- DB Record Loader:
DB FIeld: cf_uid
Table: my chronoforms_data
Request Param: user_id
Load Fields: Yes
Curly Replacer: No
Model ID: -
Load Under Model ID: No
Advanced Tab: all blank
3- Show HTML
Based on the above setting my form is not loading the data. I'm not sure what I'm doing wrong.
Thanks in advance.
Hi omidhz,
Those settings look OK to me except for the table name with looks a bit odd.
Bob
Those settings look OK to me except for the table name with looks a bit odd.
Bob
I just put a random table name in the post above.
Thn the question is why my table is not pulling the data ?
Thn the question is why my table is not pulling the data ?
Hi omidhz,
I don't know, try adding a Debugger action, I think that will show you the query that is being used.
Bob
I don't know, try adding a Debugger action, I think that will show you the query that is being used.
Bob
I added the debugger and here is what I get when I log in with the User who's User ID is 59:
Data Array:
Validation Error:
db_record_loader:
I guess the problem is that cf_uid for that user is not 59, rather it is 85d8e393f81afac56f3875bdb24ce98a. It seems like I'm not matching the loged in user_id with the cf_uid. Not sure how to fix this?
I hope this help to identify the issue.
Thanks for your help in advance.
Data Array:
Array
(
[chronoform] => edit_profile
[option] => com_chronoforms
[Itemid] =>
[user_id] => 59
)
Validation Error:
Array
(
)
db_record_loader:
db_record_loader
SELECT * FROM `joomla_chronoforms_data_register` AS `JoomlaChronoformsDataRegister` WHERE `cf_uid` = '59'
I guess the problem is that cf_uid for that user is not 59, rather it is 85d8e393f81afac56f3875bdb24ce98a. It seems like I'm not matching the loged in user_id with the cf_uid. Not sure how to fix this?
I hope this help to identify the issue.
Thanks for your help in advance.
Hi omidhz,
Have you checked the caolum names in the table - I think you probably want cf_user_id?
Bob
Have you checked the caolum names in the table - I think you probably want cf_user_id?
Bob
I do have a column with the name cf_user_id, but the data in that column doesn't match the user_id. For user_id=59, cf_user_id=0. So I guess I need to match these two tables. But would you please let me know how?
Hi omidhz,
By default ChronoForms adds the ID of the current user to the cf_user_id column. If the user isn't logged in this will be 0.
I guess you can edit the table in PHPMyAdmin to add any missing values.
Bob
By default ChronoForms adds the ID of the current user to the cf_user_id column. If the user isn't logged in this will be 0.
I guess you can edit the table in PHPMyAdmin to add any missing values.
Bob
Thanks.
The problem is that I'm using chronoforms for registration and I'm not sure how to put the new user_id that is automatically generated by Joomla into the chronoforms table?
So here is the exact steps:
1. User goes to registration form, while not registered, and they submit their information their.
2. user_id is being generated by joomla database automatically and being saved only in joomla database. While cf_user_id is being recorded in chronoform database as 0 all the time.
So the main question is how can I put the same user_id in the chronoform database under cf_user_id so that I can retrieve it then ?
The problem is that I'm using chronoforms for registration and I'm not sure how to put the new user_id that is automatically generated by Joomla into the chronoforms table?
So here is the exact steps:
1. User goes to registration form, while not registered, and they submit their information their.
2. user_id is being generated by joomla database automatically and being saved only in joomla database. While cf_user_id is being recorded in chronoform database as 0 all the time.
So the main question is how can I put the same user_id in the chronoform database under cf_user_id so that I can retrieve it then ?
Hi omidhz ,
Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.
Bob
Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.
Bob
Here it is:
Array
(
[option] => com_chronoforms
[chronoform] => register
[event] => submit
[Itemid] =>
[title] => Mr
[fname] => Tom
[lname] => Jeffery
[email] => tjefferey@test.com
[username] => tjeffery
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Colon and rectal surgery
[subspecialty] => Adult cardiothoracic anesthesiology
[phone] => 1111111111
[recaptcha_challenge_field] => 03AHJ_Vut9KIqJ4hEd4O11FK0fsVXMTivWIzefcbDEFKQiJvGvJntVqWS5bUO8Ug3I3VJE1Dd2s7nshNDx557Ba4GLSZvv9p7xhi8h0Av9Gsd6ex-evxqnZOBmlAzAumNOFITyKwhgcpdVWFP0wjyQhRFG-GQUyuKzW5Z003FAyiT28LpkjPqz0Cg
[recaptcha_response_field] => Lioritt independent
[register] => Register
[3b11d1eda7158c3d9e98544f2c0732e5] => 1
[name] => Tom Jeffery
[password] => 123456
[_PLUGINS_] => Array
(
[joomla_registration] => Array
(
[*isRoot] =>
[id] => 61
[name] => Tom Jeffery
[username] => tjeffery
[email] => tjefferey@test.com
[password] => 68d94fb1d7ae20fd8b8aabebb8a59b4b:ts5cAGIyTlhcHPM1xCLsFFpFq1X3Dnx8
[password_clear] => 123456
[usertype] => deprecated
[block] => 1
[sendEmail] => 0
[registerDate] => 2012-05-19 00:54:20
[lastvisitDate] =>
[activation] => 49ac8c13ca10bce6cb6046a39aa5d077
[groups] => Array
(
[0] => 2
)
[*_params] => JRegistry Object
(
[data:protected] => stdClass Object
(
)
)
[*_authGroups] => Array
(
[0] => 1
)
[*_authLevels] => Array
(
[0] => 1
[1] => 1
)
[*_authActions] =>
[*_errorMsg] =>
[*_errors] => Array
(
)
[aid] => 0
[group_ids] =>
[option] => com_chronoforms
[chronoform] => register
[event] => submit
[Itemid] =>
[title] => Mr
[fname] => Tom
[lname] => Jeffery
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Colon and rectal surgery
[subspecialty] => Adult cardiothoracic anesthesiology
[phone] => 1111111111
[recaptcha_challenge_field] => 03AHJ_Vut9KIqJ4hEd4O11FK0fsVXMTivWIzefcbDEFKQiJvGvJntVqWS5bUO8Ug3I3VJE1Dd2s7nshNDx557Ba4GLSZvv9p7xhi8h0Av9Gsd6ex-evxqnZOBmlAzAumNOFITyKwhgcpdVWFP0wjyQhRFG-GQUyuKzW5Z003FAyiT28LpkjPqz0Cg
[recaptcha_response_field] => Lioritt independent
[register] => Register
[3b11d1eda7158c3d9e98544f2c0732e5] => 1
)
)
[chronoform_data] => Array
(
[cf_uid] => f9e735686641f55e6c31210166652d7f
[cf_created] => 2012-05-18 20:54:21
[cf_ipaddress] => xx.xx.xx.xx
[cf_user_id] => 0
[option] => com_chronoforms
[chronoform] => register
[event] => submit
[Itemid] =>
[title] => Mr
[fname] => Tom
[lname] => Jeffery
[email] => tjefferey@test.com
[username] => tjeffery
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Colon and rectal surgery
[subspecialty] => Adult cardiothoracic anesthesiology
[phone] => 1111111111
[recaptcha_challenge_field] => 03AHJ_Vut9KIqJ4hEd4O11FK0fsVXMTivWIzefcbDEFKQiJvGvJntVqWS5bUO8Ug3I3VJE1Dd2s7nshNDx557Ba4GLSZvv9p7xhi8h0Av9Gsd6ex-evxqnZOBmlAzAumNOFITyKwhgcpdVWFP0wjyQhRFG-GQUyuKzW5Z003FAyiT28LpkjPqz0Cg
[recaptcha_response_field] => Lioritt independent
[register] => Register
[3b11d1eda7158c3d9e98544f2c0732e5] => 1
[name] => Tom Jeffery
[password] => 123456
[_PLUGINS_] => Array
(
[joomla_registration] => Array
(
[*isRoot] =>
[id] => 61
[name] => Tom Jeffery
[username] => tjeffery
[email] => tjefferey@test.com
[password] => 68d94fb1d7ae20fd8b8aabebb8a59b4b:ts5cAGIyTlhcHPM1xCLsFFpFq1X3Dnx8
[password_clear] => 123456
[usertype] => deprecated
[block] => 1
[sendEmail] => 0
[registerDate] => 2012-05-19 00:54:20
[lastvisitDate] =>
[activation] => 49ac8c13ca10bce6cb6046a39aa5d077
[groups] => Array
(
[0] => 2
)
[*_params] => JRegistry Object
(
[data:protected] => stdClass Object
(
)
)
[*_authGroups] => Array
(
[0] => 1
)
[*_authLevels] => Array
(
[0] => 1
[1] => 1
)
[*_authActions] =>
[*_errorMsg] =>
[*_errors] => Array
(
)
[aid] => 0
[group_ids] =>
[option] => com_chronoforms
[chronoform] => register
[event] => submit
[Itemid] =>
[title] => Mr
[fname] => Tom
[lname] => Jeffery
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Colon and rectal surgery
[subspecialty] => Adult cardiothoracic anesthesiology
[phone] => 1111111111
[recaptcha_challenge_field] => 03AHJ_Vut9KIqJ4hEd4O11FK0fsVXMTivWIzefcbDEFKQiJvGvJntVqWS5bUO8Ug3I3VJE1Dd2s7nshNDx557Ba4GLSZvv9p7xhi8h0Av9Gsd6ex-evxqnZOBmlAzAumNOFITyKwhgcpdVWFP0wjyQhRFG-GQUyuKzW5Z003FAyiT28LpkjPqz0Cg
[recaptcha_response_field] => Lioritt independent
[register] => Register
[3b11d1eda7158c3d9e98544f2c0732e5] => 1
)
)
[cf_id] => 3
)
[chronoform_data_cf_id] => 3
)
Hi omidhz ,
This looks like the is you need: [chronoform_data_cf_id] => 3,
The User ID should be in $form->data['chronoform_data_cf_id']
Bob
This looks like the is you need: [chronoform_data_cf_id] => 3,
The User ID should be in $form->data['chronoform_data_cf_id']
Bob
I thought that I have to add [id] => 61 to my chronoform table so that this would be a link between chronoform table and joomla table for that user in order to retrieve user's data for profile edit.
If I only have [chronoform_data_cf_id] => 3, then I can only retrieve the data in chronoform table (additional fields like specialty, country, state, and ...) but not joomla table fields (username, password, and email).
So I thought that I should have the same user_id in the joomla table to be recorded in chronoform table. Please correct me if I'm wrong.
Thanks
If I only have [chronoform_data_cf_id] => 3, then I can only retrieve the data in chronoform table (additional fields like specialty, country, state, and ...) but not joomla table fields (username, password, and email).
So I thought that I should have the same user_id in the joomla table to be recorded in chronoform table. Please correct me if I'm wrong.
Thanks
Hi omidhz,
I think it will work if you add this to a Custom Code action after the Joomla! Registration Acton and before the DB Save action
Bob
I think it will work if you add this to a Custom Code action after the Joomla! Registration Acton and before the DB Save action
<?php
$form->data['cf_user_id '] = $form->data['chronoform_data_cf_id'];
?>
Bob
I did that but still didn't record the user_id in my chronoform database.
Here is what I got:
Here is what I got:
Array
(
[chronoform] => register
[event] => submit
[option] => com_chronoforms
[Itemid] =>
[title] => Miss
[fname] => Cindy
[lname] => Jones
[email] => cjones@test.com
[username] => cjones
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Allergy and immunology
[subspecialty] => Abdominal radiology
[phone] => 1234567897
[recaptcha_challenge_field] => 03AHJ_Vuu4Mm5jSf_Jdlna4wdnrNJong5PS5jWNG5uONHHIRqWyeNVPBu4KV3QrY_IgsKpDgQr4aUp7FUqWThgrCN3wCkSQelH0faLpJupxMYi-jJmBaR6PCnu08myrQFE9qGlnhbQ4fnwEoZlY607PK3mkXV54sh57w
[recaptcha_response_field] => oceual collection
[register] => Register
[eb709c5f52b6327ceae7842f0258256e] => 1
[name] => Cindy Jones
[password] => 123456
[_PLUGINS_] => Array
(
[joomla_registration] => Array
(
[*isRoot] =>
[id] => 62
[name] => Cindy Jones
[username] => cjones
[email] => cjones@test.com
[password] => d3117cb031211e9f9e724324d29d8a54:lB2ddY9fjd4Ycl9sfpZFXITXOSWykalI
[password_clear] => 123456
[usertype] => deprecated
[block] => 1
[sendEmail] => 0
[registerDate] => 2012-05-20 09:38:53
[lastvisitDate] =>
[activation] => 34b210f6368adbd9113b9d945111d3db
[groups] => Array
(
[0] => 2
)
[*_params] => JRegistry Object
(
[data:protected] => stdClass Object
(
)
)
[*_authGroups] => Array
(
[0] => 1
)
[*_authLevels] => Array
(
[0] => 1
[1] => 1
)
[*_authActions] =>
[*_errorMsg] =>
[*_errors] => Array
(
)
[aid] => 0
[chronoform] => register
[event] => submit
[option] => com_chronoforms
[Itemid] =>
[title] => Miss
[fname] => Cindy
[lname] => Jones
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Allergy and immunology
[subspecialty] => Abdominal radiology
[phone] => 1234567897
[recaptcha_challenge_field] => 03AHJ_Vuu4Mm5jSf_Jdlna4wdnrNJong5PS5jWNG5uONHHIRqWyeNVPBu4KV3QrY_IgsKpDgQr4aUp7FUqWThgrCN3wCkSQelH0faLpJupxMYi-jJmBaR6PCnu08myrQFE9qGlnhbQ4fnwEoZlY607PK3mkXV54sh57w
[recaptcha_response_field] => oceual collection
[register] => Register
[eb709c5f52b6327ceae7842f0258256e] => 1
)
)
[cf_user_id ] =>
[chronoform_data] => Array
(
[cf_uid] => bccd5fe4cbdae634e84effbd31b762a2
[cf_created] => 2012-05-20 05:38:53
[cf_ipaddress] => xx.xx.xx.xx
[cf_user_id] => 0
[chronoform] => register
[event] => submit
[option] => com_chronoforms
[Itemid] =>
[title] => Miss
[fname] => Cindy
[lname] => Jones
[email] => cjones@test.com
[username] => cjones
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Allergy and immunology
[subspecialty] => Abdominal radiology
[phone] => 1234567897
[recaptcha_challenge_field] => 03AHJ_Vuu4Mm5jSf_Jdlna4wdnrNJong5PS5jWNG5uONHHIRqWyeNVPBu4KV3QrY_IgsKpDgQr4aUp7FUqWThgrCN3wCkSQelH0faLpJupxMYi-jJmBaR6PCnu08myrQFE9qGlnhbQ4fnwEoZlY607PK3mkXV54sh57w
[recaptcha_response_field] => oceual collection
[register] => Register
[eb709c5f52b6327ceae7842f0258256e] => 1
[name] => Cindy Jones
[password] => 123456
[_PLUGINS_] => Array
(
[joomla_registration] => Array
(
[*isRoot] =>
[id] => 62
[name] => Cindy Jones
[username] => cjones
[email] => cjones@test.com
[password] => d3117cb031211e9f9e724324d29d8a54:lB2ddY9fjd4Ycl9sfpZFXITXOSWykalI
[password_clear] => 123456
[usertype] => deprecated
[block] => 1
[sendEmail] => 0
[registerDate] => 2012-05-20 09:38:53
[lastvisitDate] =>
[activation] => 34b210f6368adbd9113b9d945111d3db
[groups] => Array
(
[0] => 2
)
[*_params] => JRegistry Object
(
[data:protected] => stdClass Object
(
)
)
[*_authGroups] => Array
(
[0] => 1
)
[*_authLevels] => Array
(
[0] => 1
[1] => 1
)
[*_authActions] =>
[*_errorMsg] =>
[*_errors] => Array
(
)
[aid] => 0
[chronoform] => register
[event] => submit
[option] => com_chronoforms
[Itemid] =>
[title] => Miss
[fname] => Cindy
[lname] => Jones
[password1] => 123456
[password2] => 123456
[country] => US
[state] => TX
[specialty] => Allergy and immunology
[subspecialty] => Abdominal radiology
[phone] => 1234567897
[recaptcha_challenge_field] => 03AHJ_Vuu4Mm5jSf_Jdlna4wdnrNJong5PS5jWNG5uONHHIRqWyeNVPBu4KV3QrY_IgsKpDgQr4aUp7FUqWThgrCN3wCkSQelH0faLpJupxMYi-jJmBaR6PCnu08myrQFE9qGlnhbQ4fnwEoZlY607PK3mkXV54sh57w
[recaptcha_response_field] => oceual collection
[register] => Register
[eb709c5f52b6327ceae7842f0258256e] => 1
)
)
[cf_user_id ] =>
[cf_id] => 4
)
[chronoform_data_cf_id] => 4
)
Hi omhidz,
Hard to tell from the debug :-( what is the order of the actions in the On Submit event?
Bob
Hard to tell from the debug :-( what is the order of the actions in the On Submit event?
Bob
Hi omidhz ,
This looks OK, perhaps I mis-read the array value for the user_id.
Please move the Debugger up just before the DB Save and see what the values are there.
Bob
This looks OK, perhaps I mis-read the array value for the user_id.
Please move the Debugger up just before the DB Save and see what the values are there.
Bob
Here is the result after moving the debugger:
Array
(
[option] => com_chronoforms
[chronoform] => register
[event] => submit
[Itemid] =>
[title] => Miss
[fname] => Sara
[lname] => Williams
[email] => swilliams@test.com
[username] => swilliams
[password1] => 123456
[password2] => 123456
[country] => US
[state] => CA
[specialty] => Colon and rectal surgery
[subspecialty] => Adult cardiothoracic anesthesiology
[phone] => 123456789
[recaptcha_challenge_field] => 03AHJ_VuvAovjAtuOVX1QsA81VkIpVgXM45GM73f3o0RErX2boXk3zjV39L970GbxrmBGMccnrK_Pc4EOj5JWq0-lBTG1KIou0lMKIzglZGkavZLp9twg8riTYlMnO3St3JGbFQmrMmsHObx_7o9R2HlYVDmcfEcQxWg
[recaptcha_response_field] => Javeow 2
[register] => Register
[a19a6c5eb69cefbd72976325613f8f53] => 1
[name] => Sara Williams
[password] => 123456
[_PLUGINS_] => Array
(
[joomla_registration] => Array
(
[*isRoot] =>
[id] => 63
[name] => Sara Williams
[username] => swilliams
[email] => swilliams@test.com
[password] => 549faa7e0924a9dde7991843df902d89:u2PkSznMKQWdQ9Vd6VQQv0j5ABrPkeVB
[password_clear] => 123456
[usertype] => deprecated
[block] => 1
[sendEmail] => 0
[registerDate] => 2012-05-21 20:08:17
[lastvisitDate] =>
[activation] => 5f7285049a83f54a5db4707ac14efad0
[groups] => Array
(
[0] => 2
)
[*_params] => JRegistry Object
(
[data:protected] => stdClass Object
(
)
)
[*_authGroups] => Array
(
[0] => 1
)
[*_authLevels] => Array
(
[0] => 1
[1] => 1
)
[*_authActions] =>
[*_errorMsg] =>
[*_errors] => Array
(
)
[aid] => 0
[option] => com_chronoforms
[chronoform] => register
[event] => submit
[Itemid] =>
[title] => Miss
[fname] => Sara
[lname] => Williams
[password1] => 123456
[password2] => 123456
[country] => US
[state] => CA
[specialty] => Colon and rectal surgery
[subspecialty] => Adult cardiothoracic anesthesiology
[phone] => 123456789
[recaptcha_challenge_field] => 03AHJ_VuvAovjAtuOVX1QsA81VkIpVgXM45GM73f3o0RErX2boXk3zjV39L970GbxrmBGMccnrK_Pc4EOj5JWq0-lBTG1KIou0lMKIzglZGkavZLp9twg8riTYlMnO3St3JGbFQmrMmsHObx_7o9R2HlYVDmcfEcQxWg
[recaptcha_response_field] => Javeow 2
[register] => Register
[a19a6c5eb69cefbd72976325613f8f53] => 1
)
)
[cf_user_id ] =>
)
Hi Bob,
I guess I'm stuck here, and I'm driving you crazy. I tried different codes but I'm still unable to add the user_id to my chronoform table.
Another ideas on how to do so?
I guess I'm stuck here, and I'm driving you crazy. I tried different codes but I'm still unable to add the user_id to my chronoform table.
Another ideas on how to do so?
I finally got this to work for me😀 The correct code to save the user id to chronoform table is as below:
<?php
$form->data['cf_user_id'] = $form->data['_PLUGINS_']['joomla_registration']['id'];
?>
Hi omidhz ,
Well found. I've no idea why the other value isn't there until later in the On Submit process - very odd :-(
Bob
Well found. I've no idea why the other value isn't there until later in the On Submit process - very odd :-(
Bob
Hi rebeccamantel ,
If you want to update an existing record then your form data must include the primary key value for that record. Usually you would do that by including it in a hidden input in your form.
Bob
If you want to update an existing record then your form data must include the primary key value for that record. Usually you would do that by including it in a hidden input in your form.
Bob
Hi rebeccamantel,
I'm confused about what you are trying to do here? From the error message it looks as though your are running the Joomla! Registration action when they are updating an existing profile. If it's an update then you don't want to run this action.
Bob
I'm confused about what you are trying to do here? From the error message it looks as though your are running the Joomla! Registration action when they are updating an existing profile. If it's an update then you don't want to run this action.
Bob
This topic is locked and no more replies can be posted.