in XiunoBBS (385℃)

修改这个文件model/user.func.php
修改第201行和第202行,将:

$user['avatar_url'] = $user['avatar'] ? $conf['upload_url']."avatar/$dir/$user[uid].png?".$user['avatar'] : 'view/img/avatar.png';
$user['avatar_path'] = $user['avatar'] ? $conf['upload_path']."avatar/$dir/$user[uid].png?".$user['avatar'] : '';

修改为以下:

$user['avatar_url'] = 'https://secure.gravatar.com/avatar/'.MD5($user['email']).'?s=100&r=G&d=identicon'; 
$user['avatar_path'] = $user['avatar_url'] ;

如果怕改了之后会出事,可以像我一样,将原来的代码打上注释,就像下面这样

//$user['avatar_url'] = $user['avatar'] ? $conf['upload_url']."avatar/$dir/$user[uid].png?".$user['avatar'] : 'view/img/avatar.png';
$user['avatar_url'] = 'https://secure.gravatar.com/avatar/'.MD5($user['email']).'?s=100&r=G&d=identicon'; 
//$user['avatar_path'] = $user['avatar'] ? $conf['upload_path']."avatar/$dir/$user[uid].png?".$user['avatar'] : '';
$user['avatar_path'] = $user['avatar_url'] ;

然后通过修改模板来隐藏下头像的上传入口,禁止用户上传或者是将upload/avatar文件夹设上“不可写”权限即可
提示:头像上传入口在view/htm/my_avatar.htm里,但改了这里的内容只是改了用户的上传面板,上传的接口还是存在的,所以才需要禁止用户上传或者是设置不可写

相关标签:#Gravatar #Xiuno BBS

许可协议: 署名-相同方式共享 4.0 国际 转载请保留原文链接及作者