Download & Extend

add content profile field (ie first name) to $user object

Project:Content Profile
Version:6.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hello,

I was wondering if anyone knows if it is possible to add the content profile field (ie first name) to the $user object so that it can be printed anywhere such as on page.tpl.php

I would appreciate the support!

Thank you

Comments

#1

You can use theme preprocess functions to make data accessible to your theme templates.

A couple good starting places are:

#2

i would like to know how to add content profile fields to $user object too...

anyone?

@jeffschuler: can you explain, please?

Thanks in advance!

#3

something like this should work:

<?php
global $user;
$node_profile = content_profile_load(profile, $user->uid);
print
$node_profile->field_firstname[0]["value"];
?>
nobody click here