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

1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
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.