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
1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 | 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.