简体   繁体   English

Buddypress中的3rd头像

[英]3rd size Avatar in Buddypress

The below is in the bp-core-avatars.php file (Line: 375). 下面是bp-core-avatars.php文件(第375行)。

/** * Look for uploaded avatar first. / ** *首先查找上传的头像。 Use it if it exists. 如果存在,请使用它。 * Set the file names to search for, to select the full size * or thumbnail image. *设置要搜索的文件名,以选择完整尺寸*或缩略图。 */ * /

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

On the line where it says $avatar_size, I need a third option called '-bptinythumb' size. 在上面写着$ avatar_size的那一行,我需要第三个选项'-bptinythumb'size。 Basically a choice between '-bpfull', '-bpthumb' and '-bptinythumb'. 基本上是在“ -bpfull”,“-bpthumb”和“ -bptinythumb”之间进行选择。

How do I do that? 我怎么做?

You'd change $avatar_size = ( 'full' == $type ) ? '-bpfull' : '-bpthumb; 您将更改$avatar_size = ( 'full' == $type ) ? '-bpfull' : '-bpthumb; $avatar_size = ( 'full' == $type ) ? '-bpfull' : '-bpthumb; to: 至:

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

But that approach wouldn't be recommended because when you upgrade BuddyPress your changes will be lost. 但是不建议采用这种方法,因为在升级BuddyPress时,所做的更改将丢失。

The tiny thumb will be the default avatar size. 小拇指将是默认的头像大小。 If you wanted to use the thumb or full versions then you'd need to pass thumb or full to bp_core_fetch_avatar 如果你想用拇指或完整版本,那么你就需要通过thumbfullbp_core_fetch_avatar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM