[development] accessing profile data
Greg Knaddison - GVS
Greg at GrowingVentureSolutions.com
Sun Oct 8 16:08:35 UTC 2006
On 10/8/06, Augustin (Beginner) <drupal.beginner at wechange.org> wrote:
> On Sunday 08 October 2006 07:54 pm, Augustin (Beginner) wrote:
> > I am sure it was in $user->data (which we had to unserialize), but it
> > doesn't seem to be the case anymore.
> Apparently, I have to use user_load() even for the current user.
> the reason I picked it up in $user->data earlier may be because the profile
> data is inside just after submitting the profile form.
> It works now.
Good to hear that you got it working - just to offer some more advice.
The profile_csv module shows ways to get at the data more directly
than user_load. It has a patch to work with the hidden fields:
"Hidden" profile information is stored in serialized form in
users.data field. The real trick comes if you have a field that is
public and then you change it to hidden: the data will then be split
between records created and not edited BEFORE the change to hidden,
which will be in the profile_* tables and the data created or edited
AFTER the change which will now be in the users.data field.
So, the safest/easiest thing is probably to use user_load as you found.
Greg Knaddison | Growing Venture Solutions
Denver, CO | http://growingventuresolutions.com
Technology Solutions for Communities, Individuals, and Small Businesses
More information about the development