bp_core_avatar_default_thumb( string $type = 'gravatar', array $params = array() )
Get the URL of the ‘thumb’ default avatar.
Description Description
Uses Gravatar’s mystery-person avatar, unless BP_AVATAR_DEFAULT_THUMB has been defined.
Parameters Parameters
- $type
-
(Optional) 'local' if the fallback should be the locally-hosted version of the mystery person, 'gravatar' if the fallback should be Gravatar's version. Default: 'gravatar'.
Default value: 'gravatar'
- $params
-
(Optional) Parameters passed to bp_core_fetch_avatar().
Default value: array()
Return Return
(string) The URL of the default avatar thumb.
Source Source
File: bp-core/bp-core-avatars.php
function bp_core_avatar_default_thumb( $type = 'gravatar', $params = array() ) {
// Local override.
if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) {
$avatar = BP_AVATAR_DEFAULT_THUMB;
// Use the local default image.
} elseif ( 'local' === $type ) {
$avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man-50.jpg';
// Use Gravatar's mystery person as fallback.
} else {
$avatar = '//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=' . bp_core_avatar_thumb_width();
}
/**
* Filters the URL of the 'thumb' default avatar.
*
* @since 1.5.0
* @since 2.6.0 Added `$params`.
*
* @param string $avatar URL of the default avatar.
* @param string $params Params provided to bp_core_fetch_avatar().
*/
return apply_filters( 'bp_core_avatar_thumb', $avatar, $params );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.6.0 | Introduced $object_type parameter. |
| 1.5.0 | Introduced. |