Closed (works as designed)
Project:
User Terms
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2012 at 16:52 UTC
Updated:
24 Jan 2012 at 17:15 UTC
It appears that while user objects receive the user_terms property within the user_terms_user function (case "load") within the function itself (verified by dpm'ing during the function, when accessing the global $user variable in other places, the object does not always have that property. Running user_terms_load_profile($user) loads the property into the object again, but why would this be an extra step? Shouldn't the object already have this property since it's been loaded? It has the user_terms_vids property, so why not user_terms, which is much more important?
Comments
Comment #1
joachim commentedI suspect this is a core issue. The global $user is not always a fully-loaded user object -- ie, it won't have been through a user_load() and hence user_terms_user function (case "load") won't have been called to load up our own properties into it.
In general, you should do something like this to make sure you have everything:
Comment #2
pianomansam commentedI suspected this, and am fine doing a manual user_load, but I just want to make sure there won't be a performance hit from the additional user_load.
Comment #3
joachim commentedThere pretty much will be, because that's the reason the global user isn't a complete object AFAIK. You're invoking hook_user() in every module that wants to have a say.
Of course if you only want this module's additions, you can shortcircuit to that function. And I suspect you that by loading it into $account rather than the global that might lessen the load but I'm not an expect on performance.