I am not sure if this is related to this topic http://drupal.org/node/183796 because I am not trying to use a CCK field.
Maybe this is impossible?
I want to pull 2 fields from the default user profile. But of course this doesn't work. .. (and I can't use token, since these values aren't available there)
<?php
global $user;
$title = ($user->profile-firstname . $user->profile-lastname);
return $title;
?>
- I am using the default user profile module to let registrants supply their first and last name (required)
- Approved users can create a "Bio" (using bio module). Since I don't want them to enter in their name again, I want to pull the first and last name from the default user profile they filled in during registration.
Comments
Comment #1
williecoetzee commentedHi,
I believe you might be looking for something like this..
global $user;
$profile = profile_load_profile($user);
$custom1 = $user->profile_custom1
To save an array of form data back into the profile:
profile_save_profile($record, $user, $category, $register = FALSE);
I got this from here: http://drupal.org/handbook/modules/profile as posted by agerson.
Comment #2
jgarbe commentedOk, I'm stumped too. I'm not getting any strings for any of these (the field I want is in the user profile area, no group, called profile_firstname)
$profile['profile_firstname']
$account->profile_firstname
This is the code I'm using...global $user should be extraneous to it I think but I threw it in there to make sure.
For the record, $account->profile_firstname works just fine for use in the user-profile.tpl.php template override files. What am I missing? Thanks for such a useful module!
Comment #3
fleshgrinder commentedI know that this is an old thread, but I want to clarify the use of the user's profile for everybody who lands on this page (via Google or something).
The function
profile_load_profile()will alter your$user-object. This function has no return values at all.Comment #4
gaurav.kapoor commented