Gravatars for Anonymous Comments

|

With Community Server, when a registered user makes a blog comment it is very common to show their avatar next to their comment. If the person making the comment is not a registered user, then typically the "anonymous avatar" would be shown. I had gone and implemented an Identicon control for anonymous comments and now I am going another step and implementing a Gravatar.

The PostGravatar control (in the bundle) can be used within a WeblogFeedbackList to show the Gravatar of the person who commented.

The last three blogs posts I made have all the pieces of the puzzle, now lets put them together!

  1. We need to store the persons email address if they are an anonymos user.
    See here:
  2. We need to show different items based on some criteria
    See here:
    • If registered --> Show Avatar
    • If not registered and specified email address --> Use PostGravatar control
    • If not registered and didn't specify an email --> Use Identicon control

I attached the code for a /themes/blogs/default/post.aspx page. If you are using a different theme you will need to modify it as needed.

Comments