Retrieving Member Avatar in BuddyPress

Retrieving member’s avatar in buddypress is simple and can be accomplished using bp_member_avatar() or bp_get_member_avatar(). They both accept arguments to control dimensions as well as CSS properties of returned image element.

Description

Retrieving member’s avatar in buddypress is simple and can be accomplished using bp_member_avatar() or bp_get_member_avatar(). They both accept arguments to control dimensions as well as CSS properties of returned image element.

bp_member_avatar($args) & bp_get_member_avatar($args);

These functions return the member avatar of currently displayed member.

Parameters

Both of these functions accept similar parameters which can be passed to the function in an array however none of it is required. The parameters that can be passed through an array to these functions are:

  • type (string | Not Required | default: thumb)
  • width (integer | Not Required | default: false)
  • height (integer | Not Required | default: false)
  • class (string | Not Required | default: avatar | CSS Class of IMG element)
  • id (string | Not Required | default: false | ID of IMG element)
  • alt (string | Not Required | default: sprintf( __( ‘Profile picture of %s’, ‘buddypress’ ), $fullname ) )

Returns

User avatar string.

Usage

Use of the function to get member avatar

Raw Functions

bp_member_avatar()

 

bp_get_member_avatar()