Buy Now
Sign in

Save user with save data in #_user_profiles table

Fredolino , March 14 at 21:02
Fredolino 304
March 14 at 21:02 #384852
Hi,

I wanted to register a new user (as in the demo with Save User)
but at the same time data should also be entered in the #_user_profiles table.

I did some experiments but it did not work. I always get this error: "1062 Duplicate entry '0-' for key 'idx_user_id_profile_key'"

Now it is in the setup that "Save User" and then "Save Data" is.
So that all user data are entered into the database at the same time, do I have to use "Save Data" in "success" of "Save User"?

I have this information:

Save User -> Black Label: joomla_user3

Save Data:
Model name: Data
Data provider: {data:}

Data override on insert:
created: {date: Y-m-e H: i: s}
{Var:} joomla_user3.id
institution: {data: jform_com_fields_firma}
strae_hausnr: {data: jform_profile_address1}
plz: {data: jform_profile_city}
wohnort: {data: jform_profile_postal_code}

Data override on Update: modified: {date: Y-m-e H: i: s}

Write action: Auto detect
Many Thanx
F.
healyhatman 6.1
March 14 at 21:20 #384853
This is what you had
{Var:} joomla_user3.id
That's a very wrong entry.
This is what you need

id:{var:joomla_user3.id}
Much better.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
Fredolino 304
March 15 at 11:37 #384872
Hi,
In the table "#_users" the correct data about "Save User" will be entered in the database.
The profile data of the user about "Save Data" in the table "_user_profiles" will not be registered. It must look like the screen.

The error message in the frontend is only "0".
My lines in "Save Data" are wrong. The "Data override on insert" states:
{User_id: id}
{Profile.address1: strae_hausnr}

"stra_hausnr" is the ID and name of the input field of the CF6 registration form.
What do I have to change?
screen.jpg
Many thanks for your help.
F.
Attachments
screen.jpg
screen.jpg
(76.97 KiB)
125 Downloads/Views
healyhatman 6.1
March 15 at 11:50 #384873
Did you do what I said? Screenshot proof please.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
Fredolino 304
March 15 at 13:13 #384874
ok...screen1.jpg
Attachments
screen1.jpg
screen1.jpg
(8.3 KiB)
121 Downloads/Views
Fredolino 304
March 15 at 13:24 #384875
from debugger:
[div]
  
Array
(
[chronoform] => registration
[event] => submit
[name] => Karl Marx
[username] => Pleppo
[email] => info@...
[confirm_email] => info---    
[password] => xx    
[password9] => xx    
[institution] => insti
[strae_hausnr] => strrrrrrrrrr
[plz] => 11111
[wohnort] => wohn
[button10] =>
[8cd96a265a46e007f7cfe1f554be7f0b] => 6055a6f4ffb12af0a20c72ead6d5b6c2
[4e5ecaa84cfeae5bd080b3ed74a4d811] => 30b83b7f48cb4a22a17c24a2a74e4888
[Itemid] => 273
[option] => com_content
[view] => article
[id] => 26
[registration] =>
)
Array
(
[validate_fields2] => Array
(
[log] => Automatic validation enabled.
[var] => 1
)

)

[/div]
Fredolino 304
March 15 at 16:26 #384878
But in the "Save User" I have the action "Save Data" in the success.

As a data provider: {data:}
Data override on insert:
{Var: joomla_user3.user_id}
{Data: plz}
{Data: wohnort}
Write action: Insert

Database table: #_user_profiles
{var: joomla_user3.user_id} is the registry action (Save User) that works. The data is stored in the table "#_users".
id is the ID of the #_users table and user_id is the ID of the #_user_profiles table.
In the table "#_user_profiles", however, the city, postal code and address1 should be stored simultaneously with the registration.
But the data is entered in suddenly newly created columns. The data for the table "#_users" are suddenly in there ....
The table contents in the green frame were made with the Reg form of Joomla and are correct.
The table contents in the red frame were made with "Save Data" in the success of "Save User".
I can not find the mistake ….
screen.jpg
Attachments
screen.jpg
screen.jpg
(174.32 KiB)
114 Downloads/Views
healyhatman 6.1
March 15 at 20:00 #384885
You need to put the name of the database field in first and then the source of the data you're putting into the field.
dbfield:{data:formfield}
dbfield:{var:actiondatavariable}
Just like I told you the first time and like the instructions and the field itself says
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
healyhatman 6.1
March 15 at 20:02 #384886
Also take out the {data:} from the data source that's telling your save data action to use all of the fields from your form.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
Fredolino 304
March 15 at 20:55 #384888
nothing is simply stored in the table "user_profiles" ...
This is now in "Data override on insert":
{Var:} joomla_user3.id
var {profile.address1: strae_haus}
screen.jpg
[/div]
Attachments
screen.jpg
screen.jpg
(137.6 KiB)
109 Downloads/Views
healyhatman 6.1
March 15 at 22:00 #384889
I gave you the exact syntax to use and even told you the exact thing to use for the id as an example. If you're not going to do it I'm sorry but I don't know how else to help you.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
healyhatman 6.1
March 15 at 22:58 #384894
But I'll try one more time. Your override on insert needs to look like this.
databasefieldname:source
So if your database has a field called alpha and you want to save the number 1 to it all the time that would be
alpha:1
If your table has a field called beta and your form has a field called name the user enters data into then you would put
beta:{data:name}
If your table has a field called gamma and your submit event has a Joomla save action called joomla_user5 and you want to save the Joomla user id it generates it would be
gamma:{var:joomla_user5.id}
Your "data source" field needs to be empty, otherwise it will look for form fields in your database that match the names of your form data in {data:} and try to put them in the database too. You are also going to want to turn OFF the Auto Save Fields and Auto Manage checkboxes.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
Fredolino 304
March 16 at 13:39 #384910
Hi,

Your last post was very important to me. I had to For example, disable "Auto save fields".

user_id: {var: joomla_user3.id}
profile_key: profile.postal_code
profile_value: {data: plz}
ordering: 6

This data gives the green database entry. I do not know yet how to insert the "". Respectively, they are always in front of Joomla.

But I can not create a 2nd record, etc., to the same user_id, e.g.

profile_key: profile.city
profile_value: {data: wohnort}
ordering: 3

profile_key: profile.address1
profile_value: {data: strae_haus}
ordering: 1
screen.jpg
Attachments
screen.jpg
screen.jpg
(73.8 KiB)
82 Downloads/Views
healyhatman 6.1
March 16 at 22:48 #384922
 Answer
For multiple entries you need multiple save data actions
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

You can now copy+paste code from forums
Fredolino 304
March 18 at 17:27 #384991
:-) solved