RiPro免插件修改用户默认头像为字母头像
RiPro默认注册是没有头像的,要么用户自己上传,要么用QQ登录,然后用户选择QQ头像,这样感觉有点不方便,这里就分享下用户默认头像为字母头像,自动根据用户名首字母获取指定头像。
本次修改主要在 ripro –> inc -> theme-functions.php 文件中修改
1. 搜索“function _the_theme_avatar()”,将该 function 函数替换为如下代码
此处内容需要 登录 并发表评论才可见
2. 搜索“// 判断头像类型”,在其上方添加如下代码(共2处)
$instance = new NameFirstChar($user->data->display_name, true, "Sharp");
$firstLetter = $instance->toUpperCase();
3. 搜索“_the_theme_avatar()”,将其替换为如下代码(共4处)
get_stylesheet_directory_uri() . '/assets/images/avatar/'.$firstLetter.'.png'
4.ripro –> inc -> admin -> page -> index.php 文件,第107行修改为如下代码
5.删除 ripro –> assets –> images 下的 avatar 文件夹内的图片,替换为下面压缩包内的图片