[documentation] [Documentation task] Document user_load must be called to get fully realized user object

g011um drupal-docs at drupal.org
Fri Aug 18 08:05:44 UTC 2006


Issue status update for 
http://drupal.org/node/57287
Post a follow up: 
http://drupal.org/project/comments/add/57287

 Project:      Documentation
 Version:      <none>
 Component:    Documentation in CVS
 Category:     tasks
 Priority:     normal
 Assigned to:  Chris Johnson
 Reported by:  Chris Johnson
 Updated by:   g011um
 Status:       active

Interestingly, with the addition of some watchdog() calls I see that
hook_user() *is* being fired in my module during a normal request. 
However, any fields added to the $user object in hook_user() seem to
disappear at some later point (confirmed by creating a page node that
simply dumps the contents of $user).




g011um



Previous comments:
------------------------------------------------------------------------

Tue, 04 Apr 2006 16:35:06 +0000 : Chris Johnson

The global $user object that exists on each page is *not* a complete
user object, contrary to what one might think.  The only time the user
object is complete is after user_load() is called, because user_load()
fires (calls) all of the hook_user() hooks, allowing modules to add
whatever data they wish to the user object.  Without user_load() being
called, none of the module-added data for the user object will exist.


This task is to add documentation about this inconsistent and
potentially misleading situation to the contrib/docs/core.php
documentation.






More information about the documentation mailing list