Monday, January 30, 2012

Default Avatar in Blogger Threaded Comments


It seems like all the hype on the new threaded comment system is cooling off. But I've decided to keep throwing comment-related tutorials, since few of my previous comment-related tutorials have gotten obsolete. Gotta make up for those posts now, don't I? Right, now.. Blog reader John Bolch has given me a fantastic idea. He said Blogger should give a default avatar to those comments left by readers with no profile images, including anonymous readers. Right now, it'll just show a blank dull image if the user doesn't have a profile image set up. Instead of waiting for Blogger to fix that, let's put a temporary fix up there, shall we? In this post, I'm gonna show you how you can give a default profile image/avatar/whatever-you-wanna-call-it to those avatar-less users.

Go to Dashboard --> Template --> Backup/Restore --> Download Full Template --> Close --> Edit HTML --> Proceed --> Find for </body> --> Paste the following code directly above </body>.
<script src='http://code.jquery.com/jquery-latest.js'/>
<script>
$("img[src='http://img1.blogblog.com/img/blank.gif']")
.attr('src', 'https://lh4.googleusercontent.com/-dK5aS3tBne0/AAAAAAAAAAI/AAAAAAAAABI/8YdPUpr9zOY/s48-c-k/photo.jpg')
.ssyby('blank')
</script>
The code in place:


That is all! Easy, isn't it? All you have to do now is replace the address in Line 4 above, with the image address that you'd like to use as your default avatar.

Update: Changing Blogger's Default Image

Looks like Blogger is rolling out an update on this. Blogger is using a default image for avatarless users. If you'd like to change this default image, use this code instead. Again, change the address in Line 4 to match the address of the default image that you'd like to use.

If you're seeing the avatar of a person's profile shadow, use this code:
<script src='http://code.jquery.com/jquery-latest.js'/>
<script>
$("img[src='http://img1.blogblog.com/img/anon36.png']")
.attr('src', 'https://lh4.googleusercontent.com/-dK5aS3tBne0/AAAAAAAAAAI/AAAAAAAAABI/8YdPUpr9zOY/s48-c-k/photo.jpg')
.ssyby('blank')
</script>
If your default avatar is Blogger's rounded corner logo, use this one instead:
<script src='http://code.jquery.com/jquery-latest.js'/>
<script>
$("img[src='http://img2.blogblog.com/img/b36-rounded.png']")
.attr('src', 'https://lh4.googleusercontent.com/-dK5aS3tBne0/AAAAAAAAAAI/AAAAAAAAABI/8YdPUpr9zOY/s48-c-k/photo.jpg')
.ssyby('blank')
</script>

Elm0D

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment

Navigate» Become author for this Blog

Manual Categories