Given a field for Content Profile for a user, how can I extract that field via code?


You'll have to load the content profile node into a variable first using content_profile_load.

This should work:

$user_profile = content_profile_load('profile', $user->uid);

That will return an object ($user_profile) that you can call the fields which you've set up. Use

echo '<pre>'.print_r($user_profile,1).'</pre>';

to see which fields are available.

Tags: Drupal 6 / Users

Similar questions

How can I extract a specific field from a set of nodes?
I am using Drupal 7. I have a custom content type with multiple fields. For example, one field contains a thumbnail image. Another is a text field. There are 36 nodes that use this custom content type. In database terms, I have 36 records. How do I have Drupal extract a specific field from each of the 36 'records' and display them on a single page?...
Extract field from content type in View and have it appear as a block next to appropriate node
I need to pull a field from a content type and have it appear as a view in the sidebar next to the node it belongs to. I can't figure out what parameter to use in Views to indicate that my view block should appear by the node it was extracted from. Maybe something to do with relationships?
extract a field and the link to content from all nodes
i have a content type and it stores user_email,title,body etc. Every node has a URL alias. How can i go through all the node, and extract the email field + the URL of that node. any clue . thanks
Link user image in user profile to image instead of user profile, drupal 7
When I visit a user profile with pictures in drupal the picture is linked to the user profile again. By clicking on the user image I'd like the full image to be shown e.g. by using lightbox. How can I do this?
Drupal: Overriding user-profile.tpl: "print theme('username', $user);" shows the logged in user´s name instead of the profile owner
Well, as the title says, I´m trying to override the whole user profile template in a Drupal 6 installation. This is what I´ve got so far: The idea is to take over the profile to show no tabs: USERNAME [edit account button] [edit nodeprofile button] [everything else that´s usually inside the user profile] My problem is that the code above, shows the...
Using a computed field: How to extract a field value from a referenced node into field collection. (Multiple value)
I have written this code inside a computed field, which has given me as result, the referenced entity numbers how are saved in the field as an array. I would like to know how to extract from the entity number a specific field, such as the title. I am using Drupal 7.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.