bp_get_group_has_avatar( int|bool $group_id = false )

Return whether a group has an avatar.

Description

Parameters

$group_id

(int|bool) (Optional) Group ID to check.

Default value: false

Return

(boolean)

Source

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

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.