1

Drupalのユーザープロファイルの電子メールフィールドは、私が理解している限りでは表示されません(正当かつ明白な理由で)。

しかし、Drupal 5.xプロファイル(nodeprofile)でユーザーの電子メールを表示する方法を知る必要がありますか?

4

3 に答える 3

3

ノード プロファイルの CCK タイプに E メール CCK フィールドを追加します。

詳細については、メール フィールドモジュールを参照してください。以下は、そのプロジェクト ページからの抜粋です。

特徴:

  • メールの検証
  • アドレスを mailto リンクに変換します
  • メールアドレスの暗号化
  • お問い合わせフォーム (表示設定を参照)
  • トークンを提供します (D 7.x の場合: エンティティ API のエンティティ トークンを使用します)
  • フィールドをビューに公開します
  • ルールで使用できます
  • パネルの統合
于 2009-05-14T13:13:50.177 に答える
1

次のように、theme_user_profile フックを変更します (現在のテーマ フォルダーにある template.php に関数を追加します)。

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;
}

アップデート。 nodeprofile モジュールを使用していることに気付きませんでした。私はそれを使用したことはありませんが、電子メールを同様の方法で表示できると確信しています

于 2009-05-14T11:06:31.090 に答える
0

$userの下を見てください。

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

このモジュールを使用することもできますhttp://drupal.org/project/logintoboggan

于 2009-07-26T13:33:45.813 に答える