bp_get_group_has_avatar( int|bool $group_id = false )

Return whether a group has an avatar.

Description

Parameters

$group_id

(Optional) Group ID to check.

Default value: false

Return

(boolean)

Source

File: bp-groups/bp-groups-template.php

6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
function bp_get_group_has_avatar( $group_id = false ) {
 
    if ( false === $group_id ) {
        $group_id = bp_get_current_group_id();
    }
 
    $avatar_args = array(
        'item_id' => $group_id,
        'object'  => 'group',
        'no_grav' => true,
        'html'    => false,
        'type'    => 'thumb',
    );
 
    $group_avatar = bp_core_fetch_avatar( $avatar_args );
 
    if ( bp_core_avatar_default( 'local', $avatar_args ) === $group_avatar ) {
        return false;
    }
 
    return true;
}

Changelog

Changelog
Version Description
BuddyPress 1.1.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.