Buy Now
Sign in

Unable to save user data

kkurtz , November 28 2017
K
kkurtz
I am trying to save data to the user table with CC6. I am using a CC form with the names as shown below and the Save User function. In the debugger it looks like all the data is there.
Array
(
[option] => com_chronoconnectivity6
[cont] => manager
[conn] => save-user
[event] => save
[Users] => Array
(
[username] => anewuser
[password] => anewuser
[name] => Anew User
[email] => anewuser@somwhere.com
[activation] => 0
[block] => 0
)

[groupsid] => 2
[button4] =>
)
The save user function asks for "Groups ids provider." But I was not sure where to get that so I created a field on the form (groupsid).
But I am getting an error that user data is missing.
Array
(
[save_users] => Array
(
[_error] => Missing user data.
[var] =>
)
)
I don't know what is missing.

The attachment shows the save_user function params.

What am I doing wrong?
KKurtz
Attachments
save_user.JPG
save_user.JPG
(35.63 KiB)
186 Downloads/Views
K
kkurtz
Can someone please answer this post!
admin
Hello kkurtz,

Your fields have the model name "Users" which means that you need to catch their data using {data:Users.name} or {data:Users.username}..etc

It's not advised to set the block/activation/groupsid as form fields, as bad users may play with this, you need to hardcode the block value and the groups ids, usually use 0 for block to auto enable the used and {value:[2]} for the groups ids to assign the new user to group id #2

The activation (if you are going to use it) need to be randomly generated using {uuid:} for example, but this value can not be set directly in the "Save user" config because you need to use the same value later in the activation email, so its better to set it earlier using a "Save to session" action, set the name to "activation_code" and the value to {uuid:} then use {session:actiovation_code} in the activation field of "save user".

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
K
kkurtz
Thanks Max. that helped. I was able to add a user to the table. Now I need to be able to update the table with revised user information.

I display a user listing with an Edit link to a form with ID, username, name, email and password. I used the Save User function to save the data but I am getting a message that a user with the same username and email already exists. How can I save edited data for a user who already exists? By the way, these function will only be available to a membership chairman. Users will not be allowed to change their own data.

Karen
admin
Hi Karen,

You will need to pass the field "id" which has the edited user id, maybe as a hidden field in this case.

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
K
kkurtz
If have to use the Save Data function I don't see a place to pass the ID. How would I do that? The ID field is on the edit form, but there is no field in the Save User function to put the id.
Thanks, Karen
admin
Hi Karen,

In the "Data override" box of the save user, use this:
id:{data:Users.id}

Assuming you have used the same syntax for the id field name.

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
K
kkurtz
Thanks Max. That worked.
Now I need to be able to delete a user from the table. I tried using the id:{data:Users.id} in the Delete Conditions of the delete function. But that doesn't seem to work. What now?

Thanks,
Karen
admin
Hi Karen,

That should work if you are passing the id value under [Users][id], how do you pass the id value ?

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
K
kkurtz
Apparently I don't have the right syntax. I have tried every combination I can think of in the Delete Conditions field:
id:{data:Users.id}
id:{data:[Users][id]}
[Users][id]
id:{[Users][id]}
Please be specific about what should go in that field.
And maybe you could explain when I should use which syntax. Here is what is so confusing: When I wanted to save an edited user I used id:{data:Users.id} in the Data Override box.However when I am reading the table to get one user I used Users.id:{data:users_id} in the Where Conditions field. The users_id was defined as users_id={var:users_table.row.Users.id} in the URL parameters of the edit link. Obviously I don't understand what to use and when.

Thanks,
Karen
admin
Hi Karen,

As you said, you supply the condition or the data override in this format:
table_field_name:value

The table field name may or may not contain the mode name (as you wish), and the "value" can be anything, the {data:xyz} returns a form field value or a value of a url parameter.

So when you use
id:{data:Users.id}
Then it means that you are expecting a value of a form field or a url parameter named Users[id], is this correct ? if not then you should change the value part accordingly!

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
K
kkurtz
Sorry. Still not getting it.

Here is how I have this set up:
user_delete_link on listing - no event, URL parms - users_id={var:users_table.row.Users.id}, popup content - {view:user_delete_confirm}
{view:user_delete_confirm} - event - delete_user_from_user_table, URL parms - users_id={var:users_table.row.Users.id}, Dynamic result - remove/closest:tr
delete_user_from_user_table event - {fn:delete_user}, {fn:check_delete_result}
delete_user function - Model: Users Table:dev_users, Delete conditions - id:{data:users_id}
admin
Hi Karen,

Please check if the user id is actually passed in the link when you hover it with the mouse ? and you can also test the link without "dynamic" support to check the link and the results in the browser's page first, is the user id passed correctly ?

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
K
kkurtz
Max,

It looks to me like the user id is being passed correctly. When I hover over the delete icon I get
dev.wplga.com/index.php/user-table-listing?conn=list-user-table&users_id=1082&event=delete_user_from_user_table.

I took out the "dynamic" and it looks OK too.

I tried putting some {debug:} commands in the event, but no debug code shows up.

What now?

Karen
admin

Hi Karen,

I think you have solved this already ? the debug shortcode should be added to the end of the "delete_user_from_user_table" event.

Best regards

Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!