Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to add user avatar to activity excerpts


Kieran
Participant

@cozzie

Thanks so much Jotem!

When I did it however the only image returned is the mysteryman avatar (for people who haven’t uploaded an avatar). Even for activity made by people with their own avatars only the mysteryman is returned.

Here’s the full code I put in:

function bp_get_activity_content() {

global $activities_template, $allowed_tags;

if ( bp_is_home() && $activities_template->activity_type == ‘personal’ ) {

$content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name );

} else {

$activities_template->activity->content = bp_activity_insert_time_since( $activities_template->activity->content, $activities_template->activity->date_recorded );

$content = $activities_template->activity->content;

$content = bp_core_get_avatar($activities_template->activity->user_id) . $content;

return $content;

}

return apply_filters( ‘bp_get_activity_content’, $content );

}

Skip to toolbar