Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
user.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Apr 2006 at 16:35 UTC
Updated:
10 Jan 2011 at 17:07 UTC
Jump to comment: Most recent
Comments
Comment #1
g011um commentedInterestingly, with the addition of some
watchdog()calls I see thathook_user()is being fired in my module during a normal request. However, any fields added to the $user object inhook_user()seem to disappear at some later point (confirmed by creating a page node that simply dumps the contents of $user).Comment #2
brunodboComment #3
brunodboChanged the component to reflect the new component categorization. See http://drupal.org/node/301443.
Comment #4
nterbogt commentedI've noticed the same thing as g011um. If it's getting fired anyway, why not just write it to the global, because you're not saving any time if it's happening at some point. Either that or just don't ever run it until you need it.
Comment #5
jhodgdonLooks like this should be documented somewhere, or perhaps fixed in the user module? Temporarily assigning to the user module to see if it should be fixed or documented.
Comment #6
jwilson3I am also seeing the same situation as comment #1, It puzzles me why if hook_user() gets run anyway that it doesnt actually update the global user object. I was able to solve this in my module's hook_user() in the following way... I've documented it here in a way that you could drop this in as a completely new module called force_userload.module. Just make sure to set the weight of this module heavier than all others, so it gets run later.
UPDATE: this worked flawlessly on my development machine, but didnt seem to work so great on my production machine. I tried the sample code here #361471: Global $user object should be a complete entity which worked better.
Comment #8
ohnobinki commented.