How to show user email in Drupal 5.x profile (nodeprofile)?

The email field in user profiles in Drupal is what I understand not to show (for good and obvoius reasons).

But I still need to know how to show custom email in Drupal 5.x profile (nodeprofile)?

+1


a source to share


3 answers


Modify the theme_user_profile binding (add the function to your template.php located in your current theme folder), for example:

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 I didn't notice that you are using the nodeprofile module. I've never used it, but I'm sure the email can be shown in a similar way.

+1


a source


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

See Email Field for details . Here's an excerpt from his project page:



Features:

  • checking letters
  • turns addresses into mail links
  • encryption of email addresses
  • contact form (see display settings)
  • provides tokens (for D 7.x: use Entity tokens from the Entity API)
  • provides fields for views
  • can be used with Rules
  • Panel integration
+3


a source


Look under $ user than.

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

      

Can you work with this module also http://drupal.org/project/logintoboggan ?

0


a source







All Articles