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

Get the forum thumbnail’s image source

Description

Source

File: bp-forums/forums/functions.php

function bbp_get_forum_thumbnail_src( $forum_id = null, $size = null, $type = null ) {
	if ( $thumbnail_id = get_post_thumbnail_id( $forum_id ) ) {
		return wp_get_attachment_image_url( $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 $group_avatar_url;
		}
	}

	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.