bp_core_avatar_dimension

Utility function for fetching an avatar dimension setting.

Description

(int|bool) bp_core_avatar_dimension( (string) $type = 'thumb', (string) $h_or_w = 'height' ); 

Returns (int|bool)

$dim The dimension.

Parameters (2)

0. $type — Optional. (string) => 'thumb'
Dimension type you're fetching dimensions for. thumb or full.. Default: thumb.
1. $h_or_w — Optional. (string) => 'height'
Which dimension is being fetched. height or width.. Default: height .

Usage

  1. if ( !function_exists( 'bp_core_avatar_dimension' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-avatars.php'; 
  3.  
  4. // Dimension type you're fetching dimensions for. 'thumb' 
  5. // or 'full'. Default: 'thumb'. 
  6. $type = 'thumb'; 
  7.  
  8. // Which dimension is being fetched. 'height' or 'width'. 
  9. // Default: 'height'. 
  10. $h_or_w = 'height'; 
  11.  
  12. // NOTICE! Understand what this does before running. 
  13. $result = bp_core_avatar_dimension($type, $h_or_w); 
  14.  

Defined (1)

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

/bp-core/bp-core-avatars.php  
  1. function bp_core_avatar_dimension( $type = 'thumb', $h_or_w = 'height' ) { 
  2. $bp =buddypress); 
  3. $dim = isset( $bp->avatar->{$type}->{$h_or_w} ) ? (int) $bp->avatar->{$type}->{$h_or_w} : false; 
  4.  
  5. /** 
  6. * Filters the avatar dimension setting. 
  7. * @since 1.5.0 
  8. * @param int|bool $dim Dimension setting for the type. 
  9. * @param string $type The type of avatar whose dimensions are requested. Default 'thumb'. 
  10. * @param string $h_or_w The dimension parameter being requested. Default 'height'. 
  11. */ 
  12. return apply_filters( 'bp_core_avatar_dimension', $dim, $type, $h_or_w );