By marknewlyn on
Hi
I am using 4.7-beta3 and I want to add some data to $user as its database intensive but changes very slowly so I don't want to recalculate it every time the block renders.
I added to my_user() the following:
case 'load': // insert into the user object hte list of books that have been subscribed to
$user->fhsst_books = $books;
$user->fhsst_stats = _user_fhsststatistics();
//var_dump($user);
break;
The var_dump shows exactly what I expect. When I try to access $user->fhsst_stats in my_block() it isn't there anymore!
Is there some special syntax for adding to $user so that the information doesn't disappear? From what I've read it seems as though I've done the right thing but it isn't working and I can't find an example thats more complicated that what I have done that I understand :-/
Any advice or pointers would be most welcome.
Thanks,
Mark
Comments
you probably need to declare global
in your block you need to declare $user.
works, just calling $user without declaring it global first won't work.
should not be necessary
the important thing is that you pass
$userby reference in the hook_user function definition:(note the ampersand '&')
edit: see profile module as an example
Still stuck ...
I think I have all of that covered, here is my _user:
I was just following the other examples but I thought that maybe there was something missing?
--
Mark Horner
Jabber/AIM/Yahoo/Gizmo/Skype/Google: marknewlyn
Co-author:
http://www.nongnu.org/fhsst
http://savannah.gnu.org/projects/fhsst
"Life is but a seg-fault away ...
Life received signal SIGSEGV, Segmentation fault.
0x42074d40 in