in avatar, buddypress, members, notification

Show Member Avatar in buddyPress notification loop

To show member 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 ) );

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.