我在这里使用此代码在节点上显示用户图片:
<?php
$user_load = user_load($node->uid);
$imgtag = theme('imagecache', 'avatar_node', $user_load->picture, $user_load->name, $user_load->name);
$attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
print l($imgtag, 'u/'.$user_load->name, $attributes);
?>
这很好用,除非用户没有图片,在这种情况下看起来很奇怪。
如果用户没有图片,如何加载默认图片。我不相信我可以访问此块中的 $picture 。
提前致谢。