drupal输出用户头像地址
我想很多新手用drupal做网站时像我一样遇到一个看似简单却让我很棘手的问题,就是用户的头像地址读取不出来,使用
<?php print_r($user)?> //结果中picture是 [picture] => 3
没办法在drupal群中向各位求教:
@[上海]闲人给出了正解:
<?php global $user; $account = user_load($user->uid); echo $account->picture->uri; debug($account); ?>
最后的方法是:
<div class="user-thumb"> <img src="<?php print $front_page;?>sites/default/files/styles/thumbnail/public/pictures/<?php global $user;$account = user_load($user->uid);print $account->picture->filename;?>" alt=""> </div>
效果图:
if you don't try,you will never know!