Welcome to BuddyDress

Our themes show off your site’s content - and do it well. We look for inspiration all around us - introducing personality for a dramatic effect that will bring your content to life.

Founded on the idea that your site should be exceptional in style and quality, we draw on classic design techniques to present a beautiful and unique collection of themes at an excellent value.

remember me
  

Showing profile’s avatar and link in comments

avatar1Today i’ll show a little trick to better integrate your WordPressMU blogs with your BuddyPress. It is really easy, but could be useful for buddypressers that are no confident with php and html.

Are you actually using Gravatar for showing user avatars in the comments of your blogs? This could be not a great affair, because your comment avatars could result different from your registered user profile avatars.

If you want to show in the comments the avatars that users have uploaded in your buddypress profile, first of all you should disable Gravatar plugin. Then open the comments.php page of your theme (not buddypress theme, but your blog’s theme) and add the following line where you want to show your avatars:

<?php bp_comment_author_avatar() ?>

I’ve inserted this line just after:

<li class=”<?php echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>

and before of :

<cite><a href=”<?php comment_author_url() ?>”><?php comment_author_link() ?></a></cite> says:

Obviously not all the comment.php pages are the same cause themes are different, but they are similar and so watching your code you should easily understand where to insert the line. They go in the foreach loop, just after the ”<li>” tag opening.

In your original code, the commenters name are linked to the website url that they have inserted in WordPressMU. If you want to link them to their Buddy Press profile in your site, just change this:

<cite><a href=”<?php comment_author_url() ?>”><?php comment_author_link() ?></a></cite> says:

into this:

<?php comment_author_link() ?> <?php _e( ‘says:’, ‘buddypress’ ) ?>

Now the commenter’s name will be linked to his buddypress profile page. Not registered usernames will be linked to the website they’ve inserted in the comment url field, and their avatar will be the classical Mistery Man.

Ps: you can recognize AndyPeatling (the Buddy Press creator) in the post image: this man is everywhere!

Comments : 5

Leave a Reply


Showing profile’s avatar and link in comments

991 Trackbacks