Forums

Joomla User Create/Update

cliffjohnson 26 Mar, 2014
Hi,

I've created many functions so far including registration and a separate db update form. Everything looking good!

Now I need to provide an update form for user profile info. I will add extra fields but haven't added them yet. I wanted to get this working first.

1. I display the info with DB Record Loader - everything looks OK here. (Model Id is blank)
2. I blank out the password field before Show HTML
3. I update with Joomla User Create/Update. I've placed this in "On Submit". I'm just trying to change the name field. All password fields are set: not required.

a) I've provided a hidden "id" field, name is id.

b) I've mapped the fields in Create/Update just as I did with Joomla User Registration.

c) Settings tab has:
->Function "Create/Update",
->Enable Old Password "No",
->User Data Path is empty.

But I'm not able to update my name field. I get my show thanks message without any errors, but field not being update.

Is there a way I can make this work?
Max_admin 27 Mar, 2014
Hi Cliff,

Did you test with other user profile fields ? Only the name field is not updated or all of them like username..etc ?

Please try to add a "Debugger" BEFORE the "Create/update" action, make sure that the id field is posted correctly.

You may also try to add "User" to the user data path setting and fix your form fields names accordingly:

"name" becomes "User[name]"


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cliffjohnson 27 Mar, 2014
Hi Max,

Thanks for your looking into this.

Here is the debugger:
Data Array:

Array
(
[option] => com_chronoforms
[chronoform] => user_reg_edit
[event] => submit
[name] => autoup superdoper
[username] => autoup
[email] => me@example.tld
[opassword] =>
[password] =>
[repassword] =>
[id] => 530
[input_submit_8] => Submit
[3975b383b6177f483207f62a2a04f8a5] => 1
)

Debugger was before Joomla User Create/Update. It looks like there's an id field there.

I tried username and that didn't update either.

I changed name to User[name] in the form and Create/Update event but then the form was never populated with the name value.

Custom Code before DB Record Loader:
<?php
$user = JFactory::getUser();
$form->data['user_id'] = $user->id;
?>

DB Record Loader: DB Field = id, Table #__users, Request Param = user_id

Thanks again.
Max_admin 28 Mar, 2014
Hi Cliff,

Ok, please test this:

#1- in the Joomla user create/update add "User" in the data path
#2- fix your form fields names, all fields names to be: User[name] or User[id]..etc
#3- fix the "Db record loader" set the "Model id" to "User" and enable the "load under model id" setting

Does this publish your form data correctly ? and does it update the table ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cliffjohnson 31 Mar, 2014
Hi again,

Sorry for the delay - on another project Friday but back again now.

I've changed all the db fields in the form to include User in path name, like User[name]. I also changed the hidden field to User[id].

On the events tab the DB Record Loader has DB Field: id, Table: #__user, Request Param: user_id, Model Id: User, and Load Under Model Id: Yes.

I changed the Custom Code to clear the password and the password is cleared.
<?php
$form->data['User']['password'] = '';
?>


Joomla User Create/Delete - I put 'User' in the path name of the form fields and set User Id name field: User[id].

Now I'm getting the form filled in but the user record is not being updated when I click submit.

Here is the new debugger on submit:
Data Array:

Array
(
    [option] => com_chronoforms
    [chronoform] => user_reg_edit
    [event] => submit
    [User] => Array
        (
            [name] => autoup superdoper
            [username] => autoup
            [email] => cliftonxxson@outlook.com
            [password] => 
            [id] => 530
        )

    [opassword] => 
    [repassword] => 
    [input_submit_8] => Submit
    [23ce2dd542b91cc4cbdf2e8d0932efac] => 1
)

Validation Errors:

Array
(
)


Interestingly the debugger output does reflect the change I made to the name field, but it's not updating Joomla db and I confirmed this with phpmyadmin.

Thanks again for your interest.
Max_admin 31 Mar, 2014
You should not change the fields names under the "Create/update user" action, your fields names there should not include the "User" string, just the plain fields names, e.g: id or name

Let me know!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.