Clanbite Since 1.2.0 Updated in 1.6.3

clanbite_render_avatar( array $args ): string

Render a complete avatar with all wrappers, shape classes, and optional overlays.

This is the main function that should be used for ALL avatar rendering across the plugin and extensions. It provides a consistent structure and filter points.

Parameters

$args (array) Required

Avatar rendering arguments.

  • $type string Avatar type: 'player', 'team', 'group'. Required.
  • $id int Entity ID (user_id, team_id, or group_id). Required.
  • $size string Size preset: 'large', 'medium', 'small', or custom size slug.
  • $context string Context identifier for filtering (e.g., 'profile', 'social_feed', 'forums').
  • $shape string Override shape: 'circle', 'square', 'hexagon'. If empty, uses setting.
  • $link bool Whether to wrap in a profile link. Default false.
  • $link_target string Link target attribute. Default empty.
  • $extra_classes array Additional CSS classes for the avatar container.
  • $show_rank bool|null Show the rank badge (level icon or number). Default null: automatic, shown when the Ranks settings enable it for this avatar's player. False forces it off.
  • $show_progress bool|null Show the XP ring around the avatar. Default null: automatic, shown when a Ranks ladder has "Show progress on avatar" enabled. False forces it off.
  • $viewer_id int Who is looking at the avatar. Default: the current user (0 for guests).
  • $object_type string What the avatar is shown in, e.g. 'post', 'reply', 'notification', 'activity', 'topic', 'card'.
  • $object_id int ID of that object (post, reply, notification…), 0 when there is none.
  • $extension string Slug of the extension that renders it (e.g. 'cp_social_kit'), so filters can target a plugin.
  • $context_data array Any extra facts a filter may need (forum ID, team ID, feed type…). Never printed.

Returns

string HTML markup.

Defined in inc/avatar-helpers.php

Changelog

VersionDescription
1.6.3Updated.
1.3.0Updated.
1.2.0Introduced.