如何在Drupal 5.x配置文件(nodeprofile)中显示用户电子邮件?

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)?

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

Add an email CCK field to your node profile CCK type.

For more details, refer to the Email Field module. Here is an excerpt from its project page:

Features:

  • validation of emails
  • turns addresses into mailto links
  • encryption of email addresses
  • contact form (see Display settings)
  • provides Tokens (for D 7.x: use Entity tokens from the Entity API)
  • exposes fields to Views
  • can be used with Rules
  • Panels Integration

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?