bp_core_avatar_default_thumb( string $type = 'gravatar', array $params = array() )
Get the URL of the ‘thumb’ default avatar.
Description
Uses Gravatar’s mystery-person avatar, unless BP_AVATAR_DEFAULT_THUMB has been defined.
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
(string) The URL of the default avatar thumb.
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 BuddyPress 1.5.0 * @since BuddyPress 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
Version | Description |
---|---|
BuddyPress 1.5.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.