BuddyDress blog

Join now to give your BuddyDress site a make over

BuddyDress latest news, announcements and comments from the BuddyDress team.

Showing profile’s avatar and link in comments

March 21st, 2009 Posted in tutorials |

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!

Tags: , ,

This entry was posted on Saturday, March 21st, 2009 at 12:47 and is filed under tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

1,135 Responses to “Showing profile’s avatar and link in comments”

  1. yvalyvol says:

    yvalyvol…

    yvalyvol…

  2. Buy dilaudid or ultram without prescription…

    Buy dilaudid or ultram without prescription…

  3. States that ultram can be shipped…

    States that ultram can be shipped…

  4. Ultram without a prescription…

    Ultram without a prescription…

  5. lqlxpiwe says:

    lqlxpiwe…

    lqlxpiwe…

  6. Ultram from india…

    Ultram from india…

  7. Ultram 800 pills no presciption…

    Ultram 800 pills no presciption…

  8. Ultram fedex overnight…

    Ultram fedex overnight…

  9. Buy ultram in florida without rx…

    Buy ultram in florida without rx…

  10. Ultram shipped to florida…

    Ultram shipped to florida…

Leave a Reply