Clanbite Since 1.2.0 Updated in 1.6.3

clanbite_render_avatar_for_interactivity( array $args ): string

Render avatar structure for Interactivity API contexts.

This creates the avatar HTML structure but leaves the src attribute for dynamic binding via data-wp-bind–src. Used by Forums, Social Feed, etc.

Parameters

$args (array) Required

Avatar rendering arguments.

  • $type string Avatar type: 'player', 'team', 'group'. Required.
  • $context string Context identifier (e.g., 'forum', 'social_feed'). Required.
  • $size string Size preset or slug. Default 'medium'.
  • $shape string Override shape. If empty, uses setting.
  • $extra_classes array Additional CSS classes for the avatar container.
  • $img_attributes array Additional attributes for the <img> tag (e.g., data-wp-bind–src).
  • $wrapper_tag string Wrapper element tag. Default 'span'.
  • $wrapper_attrs array Additional attributes for wrapper element.
  • $badge_path string Interactivity path of the author's avatar_badge object (for example context.item.author.avatar_badge). When set, the avatar gets the shape frame, the XP ring and the rank badge, driven by that object's dash, level_text, icon_url, label and hide_* fields (see clanbite_ranks_get_avatar_badge_for_rest()).
  • $show_rank_icons bool Legacy: include the rank icon stack template. Default false.
  • $rank_icons_path string data-wp-each path for rank icons.
  • $rank_icons_hide string data-wp-bind–hidden for rank icons.
  • $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 with Interactivity API directives.

Defined in inc/avatar-helpers.php

Changelog

VersionDescription
1.6.3Updated.
1.3.0Updated.
1.2.0Introduced.