bbp_get_forum_thumbnail_image( $forum_id = null,  $size = null,  $type = null )

Get the forum thumbnail’s image tag

Description

Source

File: bp-forums/forums/functions.php

function bbp_get_forum_thumbnail_image( $forum_id = null, $size = null, $type = null ) {
	if ( $thumbnail_id = get_post_thumbnail_id( $forum_id ) ) {
		return wp_get_attachment_image( $thumbnail_id, $size );
	}

	if ( $group_ids = bbp_get_forum_group_ids( $forum_id ) ) {
		$group_id = $group_ids[0];

		$group_avatar_url = bp_core_fetch_avatar([
			'item_id'       => $group_id,
			'object'        => 'group',
			'type'          => $type,
			'html'          => false,
			'force_default' => false,
		]);

		$group_default_avatar = bp_groups_default_avatar( '', [ 'object' => 'group', 'type' => $type ] );

		if ( $group_avatar_url != $group_default_avatar ) {
			return bp_core_fetch_avatar([
				'item_id'       => $group_id,
				'object'        => 'group',
				'type'          => $type,
				'force_default' => false,
			]);
		}
	}

	return '';
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 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.