bbp_get_reply_author_avatar

Return the author avatar of the reply.

Description

(string) bbp_get_reply_author_avatar( (int) $reply_id = 0, (int) $size = 40 ); 

Returns (string)

Avatar of author of the reply

Parameters (2)

0. $reply_id — Optional. (int)
Reply id
1. $size — Optional. (int) => 40
Size of the avatar. Defaults to 40

Usage

  1. if ( !function_exists( 'bbp_get_reply_author_avatar' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/replies/template.php'; 
  3.  
  4. // Optional. Reply id 
  5. $reply_id = -1; 
  6.  
  7. // Optional. Size of the avatar. Defaults to 40 
  8. $size = 40; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_get_reply_author_avatar($reply_id, $size); 
  12.  

Defined (1)

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

/includes/replies/template.php  
  1. function bbp_get_reply_author_avatar( $reply_id = 0, $size = 40 ) { 
  2. $reply_id = bbp_get_reply_id( $reply_id ); 
  3. if ( !empty( $reply_id ) ) { 
  4. // Check for anonymous user 
  5. if ( !bbp_is_reply_anonymous( $reply_id ) ) { 
  6. $author_avatar = get_avatar( bbp_get_reply_author_id( $reply_id ), $size ); 
  7. } else { 
  8. $author_avatar = get_avatar( get_post_meta( $reply_id, '_bbp_anonymous_email', true ), $size ); 
  9. } else { 
  10. $author_avatar = ''; 
  11.  
  12. return apply_filters( 'bbp_get_reply_author_avatar', $author_avatar, $reply_id, $size );