2016-05-23 33 views

回答

0

複製文件/模塊/用戶/用戶-profile.tpl.php添加到您主題的模板文件夾中,然後根據您的需求對其進行自定義。

您可以在那裏轉儲$ user變量,例如,

<div class="profile"<?php print $attributes; ?>> 
    <?php print render($user_profile); ?> 
    <?php var_dump($user); ?> 
</div> 

電子郵件地址值是$ user-> mail。

不要忘記在對主題進行任何編輯之後運行「drush cc主題註冊表」。

0
function alt_user_view($account) { 
global $user; 
    $account->content['email']['display'] = array(
    '#type' => 'user_profile_item', 
    '#title' => t('E-mail Id:'), 
    '#markup' => $account->mail . l(' (edit)', 'emailedit/' . $user->uid . '/'), 
    '#attributes' => array('class' => array('field-label')), 
    '#weight' => 10, 
    ); 

} 

我通過這種方式得到了解決方案。沒關係。

0

另一種選擇從自定義模塊做比較,從自定義主題做(custmize我曾建議模板)正在實施hook_user_view_alter,你可以在https://api.drupal.org/api/drupal/modules%21user%21user.api.php/function/hook_user_view_alter/7.x

而且第三個選項中提到參考文檔在文檔中實現另一個名爲hook_preprocess_user_profile()的鉤子,但鉤子應該在自定義主題中。

所有這一切都取決於模塊或主題,主題鉤子或主題模板。與Drupal一起工作。