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?
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?
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.
Simply you can use bp_activity_avatar()
function:
<?php bp_activity_avatar(array('user_id' => $user_id)); ?>
Output the avatar of the user for specified User ID
bp_activity_avatar( 'user_id=' . $user_id );
Returns a HTML formatted link for a user with the user's full name as the link text for specified User ID
echo bp_core_get_userlink( $user_id );
I've managed do it with code like this (without php warnings):
$imgTagAva = apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $user_id ) ) ) ) );
found it. The best solution is below:
get_avatar(get_the_author_meta('ID'), 40);
// OR
get_avatar($author_id_or_email, $size);