User Avatar in buddyPress notification loop

User Avatar in buddyPress notification loop

To display user avatar in buddypress notification-loop (You can find it in members / single / notifications / notifications-loop.php )

Below snippet will return user id of that activity ( BuddyPress stored it as  secondary_item )

$bp      = buddypress();
$user_id = $bp->notifications->query_loop->notification->secondary_item_id;

To echo avatar from user id :

echo bp_activity_avatar( array( 'user_id' => $user_id ) );


Leave a Reply

Your email address will not be published. Required fields are marked *