bbp_get_topic_author_avatar

Return the author avatar of the topic.

Description

(string) bbp_get_topic_author_avatar( (int) $topic_id = 0, (int) $size = 40 ); 

Returns (string)

Avatar of the author of the topic

Parameters (2)

0. $topic_id — Optional. (int)
Topic id
1. $size — Optional. (int) => 40
Avatar size. Defaults to 40

Usage

  1. if ( !function_exists( 'bbp_get_topic_author_avatar' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3.  
  4. // Optional. Topic id 
  5. $topic_id = -1; 
  6.  
  7. // Optional. Avatar size. Defaults to 40 
  8. $size = 40; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_get_topic_author_avatar($topic_id, $size); 
  12.  

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_get_topic_author_avatar( $topic_id = 0, $size = 40 ) { 
  2. $author_avatar = ''; 
  3.  
  4. $topic_id = bbp_get_topic_id( $topic_id ); 
  5. if ( !empty( $topic_id ) ) { 
  6. if ( !bbp_is_topic_anonymous( $topic_id ) ) { 
  7. $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size ); 
  8. } else { 
  9. $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size ); 
  10.  
  11. return apply_filters( 'bbp_get_topic_author_avatar', $author_avatar, $topic_id, $size );