bp_dd_fetch_dummy_avatar_url( string $avatar_url, array $params )

Get dummy URL from DB for Group and User

Description

Parameters

$avatar_url

(string) (Required)

$params

(array) (Required)

Return

(string) $avatar_url

Source

File: bp-core/bp-core-filters.php

function bp_dd_fetch_dummy_avatar_url( $avatar_url, $params ) {

	$item_id = ! empty( $params['item_id'] ) ? absint( $params['item_id'] ) : 0;
	if ( ! empty( $item_id ) && isset( $params['avatar_dir'] ) ) {

		// check for groups avatar
		if ( 'group-avatars' == $params['avatar_dir'] ) {
			$cover_image = trim( groups_get_groupmeta( $item_id, 'avatars' ) );
			if ( ! empty( $cover_image ) ) {
				$avatar_url = $cover_image;
			}
		}

		// check for user avatar
		if ( 'avatars' == $params['avatar_dir'] ) {
			$cover_image = trim( bp_get_user_meta( $item_id, 'avatars', true ) );
			if ( ! empty( $cover_image ) ) {
				$avatar_url = $cover_image;
			}
		}
	}

	return $avatar_url;
}

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.