Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print out User Avatar from User ID in Buddypress

Tags:

buddypress

So I have the User Id of someone in Buddypress.

What is the function to print out their Avatar?

What is the function to link to their profile?

like image 837
Jordash Avatar asked May 07 '11 23:05

Jordash


2 Answers

This will display the user avatar by user ID and also make the avatar a clickable link to their profile.

<?php $member_id = bp_core_get_userid( '1' ) ?>

<a href="<?php echo bp_core_get_user_domain( $member_id ) ?>" 

title="<?php echo bp_core_get_user_displayname( $member ) ?>">

<?php echo bp_core_fetch_avatar ( array( 'item_id' => $member_id, 'type' => 'full' ) ) ?></a>

Obviously replace the number in the first line with the userID that you want.

like image 152
gordyr Avatar answered Oct 16 '22 08:10

gordyr


Simply you can use bp_activity_avatar() function:

<?php bp_activity_avatar(array('user_id' => $user_id)); ?>
like image 31
revo Avatar answered Oct 16 '22 08:10

revo