bp_core_avatar_default_thumb

Get the URL of the 'thumb' default avatar.

Description

(string) bp_core_avatar_default_thumb( (string) $type = 'gravatar', (array) $params = array() ); 

Uses Gravatar's mystery-person avatar, unless BP_AVATAR_DEFAULT_THUMB has been defined.

Returns (string)

The URL of the default avatar thumb.

Parameters (2)

0. $type — Optional. (string) => 'gravatar'
'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 .
1. $params — Optional. (array) => array()
Parameters passed to bp_core_fetch_avatar().

Usage

  1. if ( !function_exists( 'bp_core_avatar_default_thumb' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-avatars.php'; 
  3. $type = 'gravatar'; 
  4.  
  5. // Parameters passed to bp_core_fetch_avatar(). 
  6. $params = array(); 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_core_avatar_default_thumb($type, $params); 
  10.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-avatars.php  
  1. function bp_core_avatar_default_thumb( $type = 'gravatar', $params = array() ) { 
  2. // Local override. 
  3. if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) { 
  4. $avatar = BP_AVATAR_DEFAULT_THUMB; 
  5.  
  6. // Use the local default image. 
  7. } elseif ( 'local' === $type ) { 
  8. $avatar =buddypress)->plugin_url . 'bp-core/images/mystery-man-50.jpg'; 
  9.  
  10. // Use Gravatar's mystery person as fallback. 
  11. } else { 
  12. $avatar = '//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=' . bp_core_avatar_thumb_width(); 
  13.  
  14. /** 
  15. * Filters the URL of the 'thumb' default avatar. 
  16. * @since 1.5.0 
  17. * @since 2.6.0 Added `$params`. 
  18. * @param string $avatar URL of the default avatar. 
  19. * @param string $params Params provided to bp_core_fetch_avatar(). 
  20. */ 
  21. return apply_filters( 'bp_core_avatar_thumb', $avatar, $params );