bbp_get_topic_author_avatar( int $topic_id, int $size = 40 )

Return the author avatar of the topic

Description

Parameters

$topic_id

(Optional) Topic id

$size

(Optional) Avatar size. Defaults to 40

Default value: 40

Return

(string) Avatar of the author of the topic

Source

File: bp-forums/topics/template.php

	function bbp_get_topic_author_avatar( $topic_id = 0, $size = 40 ) {
		$author_avatar = '';

		$topic_id = bbp_get_topic_id( $topic_id );
		if ( !empty( $topic_id ) ) {
			if ( !bbp_is_topic_anonymous( $topic_id ) ) {
				$author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
			} else {
				$author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
			}
		}

		return apply_filters( 'bbp_get_topic_author_avatar', $author_avatar, $topic_id, $size );
	}

Changelog

Changelog
Version Description
bbPress (r2590) 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.