Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291123

Change user email causes password problem

$
0
0

Hi all, I am having an issue with changing user email programmatically that causes the user password to be somehow corrupted and subsequently user cannot login. Kindly, allow me to explain.

I have a PHP file that allow the change of the current login user to change his/her email address:
global $user;
$user = user_load($user->uid);
$user->mail = 'user@abc.com';
user_save((object) array('uid' => $user->uid), (array) $user);

After I run this PHP file, the email was changed successfully but it has a very bad side effect. Upon logging off. The user cannot login any more. Somehow the password was changed. I had to reset the password using an Admin account.

Should anyone have any pointers, I'd be very much grateful.

Thanks very much in advance.

Regards,
Chang


Viewing all articles
Browse latest Browse all 291123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>