3rd size Avatar in Buddypress


3rd size Avatar in Buddypress

以下内容来自bp-core-avatars.php文件(第375行)

/* **首先查看上传的头像。如果存在就使用它。*设置要搜索的文件名,选择完整的大小*或缩略图。*/

$avatar_size = ( ‘full’ == $type ) ? ‘-bpfull’ : ‘-bpthumb’;
$legacy_user_avatar_name = ( ‘full’ == $type ) ? ‘-avatar2′ : ‘-avatar1′;
$legacy_group_avatar_name = ( ‘full’ == $type ) ? ‘-groupavatar-full’ : ‘-groupavatar-thumb’;

在$avatar_size那行,我需要第三个选项' -bptinythumb ' size。基本上是在' -bpfull ', ' -bpthumb '和' -bptinythumb '之间进行选择。

我该怎么做?

您将$avatar_size = ( ‘full’ == $type ) ? ‘-bpfull’ : ‘-bpthumb;更改为:

if ($type == 'full' ) {
    $avatar_size = '-bpfull';
} elseif ($type == 'thumb' ) {
    $avatar_size = '-bpthumb';
} else {
    $avatar_size = '-bptinythumb';
}

但是不推荐这种方法,因为当你升级BuddyPress时,你的更改将会丢失。

拇指将是默认的头像大小。如果你想使用拇指或完整版本,那么你需要将thumbfull传递给bp_core_fetch_avatar