bp_core_avatar_default( string $type = 'gravatar', array $params = array() )
Get the URL of the ‘full’ default avatar.
Description
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.
Source
File: bp-core/bp-core-avatars.php
function bp_core_avatar_default( $type = 'gravatar', $params = array() ) { // Local override. if ( defined( 'BP_AVATAR_DEFAULT' ) ) { $avatar = BP_AVATAR_DEFAULT; // Use the local default image. } elseif ( 'local' === $type ) { $size = ''; if ( ( isset( $params['type'] ) && 'thumb' === $params['type'] && bp_core_avatar_thumb_width() <= 50 ) || ( isset( $params['width'] ) && $params['width'] <= 50 ) ) { $size = '-50'; } $avatar = buddypress()->plugin_url . "bp-core/images/mystery-man{$size}.jpg"; // Use Gravatar's mystery person as fallback. } else { $size = ''; if ( isset( $params['type'] ) && 'thumb' === $params['type'] ) { $size = bp_core_avatar_thumb_width(); } else { $size = bp_core_avatar_full_width(); } $avatar = '//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=' . $size; } /** * Filters the URL of the 'full' default avatar. * * @since BuddyPress 1.5.0 * @since BuddyPress 2.6.0 Added `$params`. * * @param string $avatar URL of the default avatar. * @param array $params Params provided to bp_core_fetch_avatar(). */ return apply_filters( 'bp_core_avatar_default', $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.