I have a user hook that has been working for several months. Nothing in my hook has changed. Maybe some other update is conflicting with the hook? You can see by my debugging output that I print the loaded object which shows one password. Then after called user_save on the object, I load the object again and the password has been saved. If I comment out the login logic completely and never do a user_save, the password continues to work fine.

stdClass Object ( [uid] => 5382 [name] => test [pass] => b04083e53e242626595e2b8ea327e525 [mail] => myemail@unc.edu [mode] => 0 [sort] => 0 [threshold] => 0 [theme] => [signature] => [signature_format] => 0 [created] => 1290188540 [access] => 1290191765 [login] => 1290192697 [status] => 1 [timezone] => -18000 [language] => [picture] => [init] => diana.woodhouse@unc.edu [data] => a:8:{s:6:"uncpid";s:9:"111111111";s:8:"lastname";s:4:"Test";s:9:"firstname";s:4:"Test";s:13:"form_build_id";s:37:"form-27b5b621fccbdbe9b4b661d48126c2f6";s:7:"contact";i:1;s:8:"graddate";s:10:"2010-10-01";s:17:"messaging_default";s:4:"mail";s:27:"notifications_send_interval";s:1:"0";} [timezone_name] => America/New_York [uncpid] => 111111111 [lastname] => Test [firstname] => Test [form_build_id] => form-27b5b621fccbdbe9b4b661d48126c2f6 [contact] => 1 [graddate] => 2010-10-01 [messaging_default] => mail [notifications_send_interval] => 0 [roles] => Array ( [2] => authenticated user [4] => alumni ) ) myUser->uid = 5382
call user_save
call user_load again

myUser:
stdClass Object ( [uid] => 5382 [name] => test [pass] => 23dd3b9744724cf94c3a43d468957d29 [mail] => myemail@unc.edu [mode] => 0 [sort] => 0 [threshold] => 0 [theme] => [signature] => [signature_format] => 0 [created] => 1290188540 [access] => 1290191765 [login] => 1290192697 [status] => 1 [timezone] => -18000 [language] => [picture] => [init] => diana.woodhouse@unc.edu [data] => a:8:{s:6:"uncpid";s:9:"111111111";s:8:"lastname";s:4:"Test";s:9:"firstname";s:4:"Test";s:13:"form_build_id";s:37:"form-27b5b621fccbdbe9b4b661d48126c2f6";s:7:"contact";i:1;s:8:"graddate";s:10:"2010-10-01";s:17:"messaging_default";s:4:"mail";s:27:"notifications_send_interval";s:1:"0";} [timezone_name] => America/New_York [uncpid] => 111111111 [lastname] => Test [firstname] => Test [form_build_id] => form-27b5b621fccbdbe9b4b661d48126c2f6 [contact] => 1 [graddate] => 2010-10-01 [messaging_default] => mail [notifications_send_interval] => 0 [roles] => Array ( [2] => authenticated user [4] => alumni ) )

Comments

woodhous@email.unc.edu’s picture

meant to say "password has been changed" not "saved". i also changed the email in the debugging, but I missed a few places and apparently there is no way to edit the original post or delete and start over.

woodhous@email.unc.edu’s picture

Problem Solved!

Do this after loading the user object and before saving it.

unset(myUser->pass)

If the password is set, the module will try to encrypt it and save it again. If the password is not set, it is not updated.

bdsl’s picture

Status: Active » Closed (works as designed)