[Solved] CCK field in uprofile

  • Visitor
Posted: Thu, 11/01/2007 - 05:33

Hi,
This is probably obvious for everyone.....
How can I display a CCK field from the content type 'uprofile' for a specific user?

In the file node-uprofile.tpl.php I can display the CCK filed from 'uprofile': 'field_full_name' with this code:
$node->content['field_full_name']['#value']
That is because we are at the node which contain the info of a specific user.

But how can I get the full name of a specific user anywhere else on the site? For example if I want to display the full name of user with uid=10. Then I want to get the 'field_full_name' that user uid=10 has saved in the content type 'uprofile'.

Thanks!
Tim

this works: <?php$account =

  • Anonymous (not verified)
  • Thu, 11/01/2007 - 07:23

this works:

<?php
$account
= node_load(array('type'=>'uprofile', 'uid'=>$object->uid));
$fullname = $account->field_full_name[0]['value'];
?>

Tim

Cool

  • Michelle
  • 05/13/07
  • Fri, 11/02/2007 - 10:24

You beat me to it :)

Michelle

So, to display the first

  • Anonymous (not verified)
  • Sat, 11/03/2007 - 13:19

So, to display the first name of a buddy in a user's buddylist, I tried putting:

<?php
$account
= node_load(array('type'=>'uprofile', 'uid'=>$object->uid));
$firstname = $account->field_first_name[0]['value'];
?>

at the bottom of the "views-list-buddylist_of_uid.tpl.php" file.
this didn't work unfortunately
where am i going wrong?
many thanks

about adding that code..

  • Visitor (not verified)
  • Wed, 03/11/2009 - 07:50

i think i have the same problem but, what i cannot do is "PHP" itself :)
a newbie..

so would you please tell me where to put this code? before or after smth.. or in my situation, there would be another settings or smth??

please help thanks! :)