I am trying to add just some fields, not the whole profile to an area of my custom user-profile.tpl.php. I don't want the whole thing so I can't use $content_profile->get_view('profile').

I tried content_view_field using the following, but it didn't return any output.

$profile_node = content_profile_load('profile', $account->uid);
print content_view_field('field_member_websites', $profile_node); 

I could see that $profile_node contained a field called 'field_member_websites' when I did print_r ($profile_node) and that the field had data, but nothing showed up when I did print content_view_field('field_member_websites', $profile_node); I also saw that the API documentation for content_view_field http://api.audean.com/api/function/content_view_field/API+Reference says not to use it in nodes and to use $FIELD_NAME_rendered variables instead.

print $field_member_websites_rendered;

That didn't return anything either. I can manually get the value of the fields and format them myself, but if I can get them pre-rendered it would be great. Any ideas what I'm doing wrong? Any help would be appreciated.

Thanks,
Nancy

Comments

scalp’s picture

I'm trying to do the same thing and having NO luck. Let us know if you get it figured out.

casperloc76’s picture

If anyone is looking for a solution on how to print a Content Profile field within a custom user-profile.tpl.php here is the code:

<?php
$node = content_profile_load('name_of_content_type', $user->uid);
print $node->name_of_field[0]['value'];
?>

God Bless,
Jeff