Friday, April 25, 2008

Code Fix Re: Yesterday's Post

Remember the code I told you about yesterday? The one that will highlight the blog owner's comments and set them apart from visitor comments? Well there's a problem with it. -But I fixed it. :)

<ENTERING GEEK MODE>

I wrote to the blog owner who posted the original code so they will probably (hopefully) make this, or a similar, change on their site, but for now, here's the code fix for anyone who's interested:

Follow the instructions on this page, but when you're done, delete this line:

<b:if cond='data:comment.author == data:post.author'>

and put the following line in its place:

<b:if cond='data:comment.authorUrl == &quot;INSERT THE URL FOR YOUR BLOGGER PROFILE HERE&quot;'>

Make sure you insert the URL for your blogger profile where it says "INSERT THE URL FOR YOUR BLOGGER PROFILE HERE"

What this fixes:

Previously, the code would check to see if the blog owner's name matched the commenter's name. If you have a unique name like "Nora-bee" :) chances are none of your commenters will have that same name as you. But if your name is Melissa or Joe or Hillary or Alice, or another more common name, then any other person coming to your blog that has the same name as you would also have had their comments highlighted just like yours.

With the code fix above, blogger will check your blogger profile URL against the URL of the person leaving a comment (instead of comparing your names). Could someone still input your blogger profile URL as theirs and pretend to be you? Sure. So it's not 100% foolproof. But that's a lot less likely to happen than someone having the same name as you.

And at the risk of getting a little more geeky on you here:

If you're fairly decent with coding, you should also be able to adapt the code for multiple blog authors by using multiple "if" statements with corresponding styles.

</END GEEK MODE>


 

4 Comments:

Alice said...

um, ok, i'm TOTALLY impressed. dang.

Grandy said...

**entering idiot mode**

Is there an html code for what the hell did you just say?

**ending idiot mode**

Melissa said...

Yeah... I was a little hesitant to let you guys see "that part of my brain" but since I gave you the link to that code and then found a bug in it, I figured I had to let you know!

And more specifically to Grandy: The short version is "If you used the code I linked to yesterday, then make one more change to it. If you didn't, just keep moving right along! There's nothing to see here!" :)

Grandy said...

Oh...that much I can follow.