How to get the user's e-mail from a selected profile

Events happening in the community are now at Drupal community events on www.drupal.org.
baltusf's picture

Hi,

I hav made a node-profile.tpl.php for showing information about a specific uers. In the node-profile i added some cck-fields witha additional information.
What i want now is to display the e-mail address of the person from which i show his profile. How can i get that. I know that with

global $user;
print $user-->email;

I got the e-mail address from the user who is logged on... But how to get the users e-mail address from the profile?

Thnx,
Fred

Comments

Try loading the user object

nivelula's picture

Try loading the user object for the author of the node like this:

<?php
$author
= user_load($uid);
?>

and then you can print the email like this:

<?php
print render($author->mail);
?>

This is for Drupal 7.x. Hope it helps...

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week