Buy Now
Sign in

Joomla User Update

omidhz , June 14 2017, 04:24
omidhz 295
June 14 2017, 04:24 #369376
I'm trying to create a form that my user can update their password. I'm using the Joomla Save User element in the setup for this purpose, but unfortunately, when I use that I get an error that user already exist. I'm not sure how I can have this done.
Here is a screenshot of how I setup my Save User action.
(50.08 KiB)
589 Downloads/Views
GreyHead 64
June 14 2017, 12:47 #369392
Hi omidhz ,

I believe that the Save User action is designed to create a new user with all the info, if you just want to update the password then you'll need to use the Joomla! JUser object code in a Custom Code action in your form. Note that Joomla! does not save the password, - just a hashed string that can be used to match the password.

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
omidhz 295
June 15 2017, 01:17 #369436
I was able to make this form and it now works beautifully. If anyone else is interested, here is what I have done:
1- Create two text fields "new_password" and "new_password_confirm".
2- In setup, add a custom php code and enter the following:
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($this->data['new_password'], $salt);
$this->data['password'] = $crypt.':'.$salt;

3 - Add Save Data element after that with the following setting:
    - Auto manage the data table: OFF
    - Database table: xxx_users
    - Data provider: {data:}
    - Write action: Update
    - Data override on Insert: EMPTY (delete everything that is there
    - Dataoverride on Upda: password:{data:password}
    - Auto save fields: OFF
    - Update conditions: id:{user:id}
    - Special fields: EMPTY

Here is a screenshot for better understanding
(85.88 KiB)
547 Downloads/Views