2013-11-27 48 views
0

我想一些標記中的template.php爲什麼我不能添加自定義標記來user_profile

function athens_preprocess_user_profile(&$variables) { 
$markup = 'hello'; 

$variables['elements']['social'] = array(
'#weight' => 0, 
'#markup' => '<div class="clearfix"></div><div class="author-social">' . $markup . '</div>', 
); 

但注意到變化:(

+0

改爲使用用戶配置文件的掛鉤 –

回答

0

user-profile.tpl.php模板添加到用戶的個人資料頁

使用$user_profile進行輸出渲染,您應該將您的自定義標記字段添加到user_profile密鑰中

function athens_preprocess_user_profile(&$variables) 
{ 
    $markup = 'hello'; 

    $variables['user_profile']['social'] = array(
     '#weight' => 0, 
     '#markup' => '<div class="clearfix"></div><div class="author-social">' . $markup . '</div>', 
    ); 
} 
相關問題