I've got a module that uses hook_user to store some calculated info for the user as a serialized object.

Everything works fine except for $op == 'load', i.e., the form works, the data is validated, it's serialized, it's saved in the database properly and it's even unserialized properly for $op == 'form'.

In hook_user, if $op == 'load', I unserialize $account->myinfo and save it back as an object in $account->myinfo.

But, later, in my theme code looks at $account->myinfo and it is serialized (even though it was unserialized in mymodule_user during $op = 'load').

Somewhere in the middle of things it gets switched back (I did some following of the drupal code in PHpED and saw that it was fine for a while, but got bashed. I don't know drupal's internals well enough to find where it gets changed without going through each line of code.)

I also tried saving the object to the $edit argument (in $edit['myinfo']) in hook_user for $op='load'.

It sure seems like this should work.

Comments

sumgai’s picture

Ding! Any comments on this?

I assume that changes to the $user object made in hook_user ($op='load') should persist and be available to theme functions?

sumgai’s picture

Version: 6.3 » 6.4
nterbogt’s picture

Something to think about:
http://drupal.org/node/57287

NROTC_Webmaster’s picture

Version: 6.4 » 6.x-dev

Is this still an issue?

NROTC_Webmaster’s picture

Status: Active » Closed (cannot reproduce)