views:

431

answers:

3

The email field in user profiles in Drupal is as far as i understand not ment to be shown (for good and obvoius reasons).

But I still need to know how to show user e-mail in Drupal 5.x profile (nodeprofile)?

+1  A: 

Change the theme_user_profile hook (add the function to your template.php located at your current theme folder), like this:

function <your_theme_name>_user_profile($account, $fields) {
  // adding the email field to profile
  $email = array();
  $email["value"] =  check_plain($account->mail);
  $fields["email"][0] = $email;
  // end of adding the email field

  // the rest of the default profile hook taken from http://api.drupal.org/api/function/theme_user_profile/5
  $output = '<div class="profile">';
  $output .= theme('user_picture', $account);
  foreach ($fields as $category => $items) {
    if (strlen($category) > 0) {
      $output .= '<h2 class="title">'. check_plain($category) .'</h2>';
    }
    $output .= '<dl>';
    foreach ($items as $item) {
      if (isset($item['title'])) {
        $output .= '<dt class="'. $item['class'] .'">'. $item['title'] .'</dt>';
      }
      $output .= '<dd class="'. $item['class'] .'">'. $item['value'] .'</dd>';
    }
    $output .= '</dl>';
  }
  $output .= '</div>';

  return $output;
}

Update. Sorry, didn't notice that you're using nodeprofile module. I've never used it, but am pretty sure the email can be shown the similar way

voidmain
+3  A: 

Add an email cck field to your node profile cck type.
http://drupal.org/project/email

Sharique
Maybe my question wasn't clear enough . But I wanted to show the email the users registered their account with, and not just add another email-field.
pm
Than may be panels can help you, it has option to show user profile fields in block.
Sharique
A: 

Look under $user than.

global $user;
// You can use dsm with the devel module instead of print_r
print_r($user);

You can work with this module also http://drupal.org/project/logintoboggan?

Adi
look also at http://api.drupal.org/api/function/user_load/6
Adi