Updating default avatar
- This topic has 5 replies, 3 voices, and was last updated 8 months, 3 weeks ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
Apologies if this has been asked before, though I didn’t see it when I searched!
To update the default/empty avatar placeholder from the cbox logo to our own OL logo, is there another way besides swapping the multiple files in the cbox OL core plugin?
Thanks!
Hi S.G, – Im taking a peek at this now – back soon – Ryan
Having a bit of trouble as well, Im going to default to Bree & Ray on this.
Yes, it’s possible, but this is not an admin dashboard option at this time. You’ll have to write some code so you can use your own custom default avatars.
This is where OpenLab sets the default avatar:
https://github.com/cuny-academic-commons/cbox-openlab-core/blob/27913ac024f96dd31eac6887423650581e49820f/includes/brand-settings.php#L158-L179
So you can do something similar:
function my_custom_default_avatar( $size = 'full' ) {
$size_suffix = 'full' === $size ? '-full' : '-thumb';
return 'URL OF YOUR DEFAULT AVATAR';
}
add_filter(
'bp_core_avatar_full',
function( $full ) {
return my_custom_default_avatar( 'full' );
},
20
);
add_filter(
'bp_core_avatar_thumb',
function( $thumb ) {
return my_custom_default_avatar( 'thumb' );
},
20
);
Replace ‘URL OF YOUR DEFAULT AVATAR’ with the URL where your default avatar is located.
Notice the 20
in the code above. This means that this code will have higher priority than the code in OpenLab.
Put it in the other code snippets you have in place in wp-content/mu-plugins
.
Let me know if you have any questions.
Thanks very much–I’ve passed this on to Chris.
Hi everyone,
Perhaps this option has been added to the admin dashboard in a subsequent release, because I came across it and updated our avatar.
Just leaving the path here in case others are interested: appearance, customize, logos, Default Profile Photo.