WordPress filter hook

bp_get_activity_avatar

Fired by 4 WordPress plugins, running on 90K+ sites between them.

“Filters the value returned by bp_core_fetch_avatar.”

How to use bp_get_activity_avatar

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'bp_get_activity_avatar', function( $core_fetch_avatar ) {
	// Change $core_fetch_avatar here.
	return $core_fetch_avatar;
}, 10, 1 );

Argument names come from BuddyPress's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

4 plugins that fire bp_get_activity_avatar

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. BuddyPress icon BuddyPress90,000+ installs apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $r['type'], 'alt' => $r['alt'], 'class' => $r['class'], 'width' => $r['width'], 'height' => $r['height'], 'email' => $r['email'], ) ) ) bp-activity/bp-activity-template.php:1096
  2. BuddyPress Edit Activity Stream icon BuddyPress Edit Activity Stream40+ installs apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height ) ) ) bp-activity-edit.php:217
  3. BuddyPress Activity Tags icon BuddyPress Activity Tags10+ installs apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) ) bp-activity-tags.php:434
  4. MIF BP Customizer icon MIF BP Customizer10+ installs apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $reposted_activity->user_id, 'object' => 'user', 'type' => 'thumb', 'class' => 'avatar', ) ) ) inc/repost-button-template.php:48

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.