Hello,
I made a registration via CFv5. Everything is OK.
I made also the form for users to make themselve some changes, like chaning the mail address, the password etc...
What I did for this form in a setup tab is a DB Read with a condition to get the current user:
and in a submit action, before a DBsave, I have a custom code and alse Joomla registration component:
When I try to change in front end email address and password, I got the message:
What could I do to make this change also in joomla #__users table?
Thanks in advance for your help
Bertrand
I made a registration via CFv5. Everything is OK.
I made also the form for users to make themselve some changes, like chaning the mail address, the password etc...
What I did for this form in a setup tab is a DB Read with a condition to get the current user:
<?php
$user = JFactory::getUser();
return array("user_id" => $user->get("id"));
?>
and in a submit action, before a DBsave, I have a custom code and alse Joomla registration component:
<?php
$form->data['Name'] = "{$form->data['FirstName']} {$form->data['LastName']}";
$form->data['_PLUGINS_']['joomla_registration']['name']=$form->data['Name'];
$form->data['_PLUGINS_']['joomla_registration']['username']=$form->data['Username'];
$form->data['_PLUGINS_']['joomla_registration']['email']=$form->data['Email'];
$form->data['_PLUGINS_']['joomla_registration']['password']=$form->data['Password'];
?>
When I try to change in front end email address and password, I got the message:
Couldn't save new user, Joomla returned this error : Username in use.
What could I do to make this change also in joomla #__users table?
Thanks in advance for your help
Bertrand
Hi Bob,
Thank you for your help.
I wrote a custom code to change values in #__users table. All values could be changed.
I could not login with the new password. I must miss something that I did not masterize.
Here is the code.
Is there something I omitted? Even with the previous method,
Thanks
Bertrand
Thank you for your help.
I wrote a custom code to change values in #__users table. All values could be changed.
I could not login with the new password. I must miss something that I did not masterize.
Here is the code.
<?php
$user = JFactory::getUser();
$data = array();
$data['name'] = $form->data['FirstName'].' '.$form->data['LastName'];
$data['username'] = $form->data['Username'];
$data['email'] = $form->data['Email'];
$password = JUserHelper::hashPassword($form->data['Password']);
$data['password'] = $password;
$data['password2'] = $password;
$data['sendEmail'] = 1; // user receive system mails
$user->bind($data);
$user->save();
?>
Is there something I omitted? Even with the previous method,
$salt = JUserHelper::genRandomPassword(32);
$crypt_password = JUserHelper::getCryptedPassword($form->data['Password'], $salt);
$data['password'] = $crypt_password.':'.$salt;
.....
Thanks
Bertrand
This topic is locked and no more replies can be posted.