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

1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
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.