Pages

Wednesday, October 5, 2011

34

How to Highlight author comments in Blogger

Update Jan 17th 2012: now uses simpler code.
Update January 18th 2012: A new and easy to install threaded commenting hack version 2 includes this hack's functionality, you might consider using it.

There are some highlight author comments hacks out there, but most I've seen check only that comment author name is something. It is better to check the author url (so anonymous user's won't disquise as you so easily), which my hack does. But it is easiest to use the variable "data:comment.authorClass" – for blog authors it is set to "blog-author", and we can check that. Basically my hack puts all "user comments" into div with class "normal-comment", and "admin comments" into div with class "admin-comment".

Edit your template html. Select Expand Widget Templates. Find line:
          <b:loop values='data:post.comments' var='comment'>
After that add:

Data provided by Pastebin.com - Download Raw

Remember to change the url between the &quot;s to your profile page url. In the old code you needed to change the url, in this new code you don't have to change anything. Then find lines:
                <b:include data='comment' name='commentDeleteIcon'/>
              </span>
            </dd>
(you can search using the first line). Just after those lines add:
            &lt;/div&gt;
Then save the template. Now we need only to style the admin-comment to look different. Go to Template Designer, choose Advanced, Add CSS, and add following:
.admin-comment {
background: #F4F4F4;
margin-top: 6px;
margin-bottom: 6px;
padding: 3px 3px 0 3px;
border: 1px solid #EDEDED;
}
And then to the testing. You can style admin-comment background otherwise, if you like, using CSS. I have installed this hack on this blog.
[Hide comments] - [Show comments]
Click on a single comment to hide/show its text

34 comments:

Unknown said... [reply]

Hi! I've tried your hack and it works fine....except it only highlights my username and left out my comment!!

you can check it here: http://crazy-cake.blogspot.com/2011/11/kimi-to-boku-ed-single-nakimushi.html#comment-form

MS-potilas said... [reply]

@H0shi
Hi,

Thanks for trying this :) I think you have misplaced the second code to be inserted in the template, i.e. this:

  &lt;/div&gt;

If you put that code too early in the template, the admin-comment div is closed too early and the style (different color background) affects only until that point.

Beben Koben said... [reply]

we can do it like it too, same worked, but it's use default coded author ;)
<b:if cond='data:comment.author == data:post.author'>
&lt;div class=&#39;admin-comment&#39; id=&#39;x<data:comment.anchorName/>&#39;&gt;
<b:else/>
&lt;div class=&#39;normal-comment&#39; id=&#39;x<data:comment.anchorName/>&#39;&gt;
</b:if>
try it...hehehehe

Beben Koben said... [reply]

ITS hacked WORKED TOO...I'll try it
shauhsuahsuhauhsuahusha
good good master :)

MS-potilas said... [reply]

@Beben Koben
Hi, thanks, your solution is good because you don't have edit your userid to source code.

But there is one small problem: if you have Name/url commenting enabled, someone can comment entering the same username as the post author, but not logged in... then his/her comment will be highlighted. So that is why I used the authorUrl/profile url in my hack. :)

Beben Koben said... [reply]

@MS-potilas wooo like it, ic ic :)
i changes anymore...ohohohohoho
ty ty

Beben Koben said... [reply]

if i'm using code from you not worked!
used my code worked for background for author?
hehehe it's oke i'm use code by me :D

♥EcchiCatgirl♥ said... [reply]

i tried the hack and it didnt work.

i think my problem is that i dont redirect my readers to a page like you have.

if it helps, here is my blog.
http://cuteanimereviews.blogspot.com/

when i try to click reply, it does nothing. any help is appreciated.

MS-potilas said... [reply]

@EcchiCatgirl

Hi, you have in your blog the new Blogger's threaded commenting enabled. When that is enabled, no comment hacks, like this hack, my reply to posts hack and my threaded comments, don't work.

The reply button you are seeing belongs to Blogger threaded commenting. There are bugs, one of them is that Reply button does not work on some browsers.

If you want to use any comment hacks, you have to disable Blogger's threaded comments. Here is an article how: http://yabtb.blogspot.com/2012/01/how-to-disable-bloggers-new-threaded.html.

DBookWhore said... [reply]

Hi Did you update this recently? I used this hack awhile back and it worked great. But then randomly when users would comment after verification the submit button would be missing..I tried to go back a remove the hack but non of it is matching up.. I need serious help!!

MS-potilas said... [reply]

@DBookWhore
Hi, there are no updates on this hack. This hack and the threaded commenting hack only changes how the comments look on the screen, i.e. makes the link for replying, indents for threading, etc. It does not change the actual process of leaving the comment. I checked your blog, and based on your explanation, I think your problems (or your readers' problems) are somewhere else, probably with Blogger's commenting system: when leaving a comment the submit button is missing. That is something these hacks cannot affect. You could try using Full page commenting (now it is Popup). Hope you get it sorted.

DBookWhore said... [reply]

Ya I switched to the pop out system bc it was when I had it on embedded for some reason the verification button just disappeared out of the blue. Thanx for your help.

CJ said... [reply]

Threaded comments works like a charm on my blog, except for author names with accent or apostrophe like O'Brian as you can see here at the bottom page : http://un-plan.blogspot.com/2009/12/aliens.html

Would you know one good solution to solve this please ?

MS-potilas said... [reply]

@CJ Hi, your blog seems to be using Blogger's new threaded comments, and I think you've found one more bug in it. You could try asking this in the help forums. Eventually Blogger should fix that bug.

robbie said... [reply]

Possible modifications?

On a blog with multiple authors and admins, is it possible to only highlight the comments of the author of that particular post, leaving other author's/admin's comments appearing unchanged? So in essence, only the post's author's text is highlighted.

Further, in the same scenario of multiple admins/authors, would it be possible to only highlight the blog creator's comments?

Thank you.

MS-potilas said... [reply]

@robbie
Hi, you could try something like this:

1. Post author comments highlighted, change first line to:

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

2. Only blog creator comments highlighted, change first line to:

<b:if cond='data:comment.author == &quot;BLOG_CREATOR&quot;'>

Change BLOG_CREATOR to blog creator's name.

I did not test these, but they should work... :)

robbie said... [reply]

@MS-potilas

Thank you MS-potilas. I'll have to investigate these two options.

Kitsune Shan said... [reply]

Hello, I tried this and many others hacks to highlight comments without result :(

Im using this template right now:
http://www.premiumbloggertemplates.com/2012/01/igaming-premium-blogger-template.html/demo/

So I wonder what should I change to get that working.

Also, how do I get back the default image effect? I mean when you open an image with the default template, then the images zooms on screen leaving a dark background behind. Right now my blog just open the image leaving the blog.

And I found that my reply button doesnt do nothing. Is a problem in the theme? could be fixed?

I know I asked too much, I hope you can help me at least on the highlight hack. Sorry for my bad english and many thanks ^^

MS-potilas said... [reply]

@Kitsune Shan Hi, let's see what I can do :)

I think the problem with the author highlight is where to put the code &lt;/div&gt; in the template you're using.

When following the instructions and trying to find a place for that, try instead finding the next line that contains </loop> and put &lt;/div&gt; before that line.

About "lightbox image effect": look your blog's Settings, Posts and Comments, there is setting "Showcase images with Lightbox" that should be "yes". If that won't work, then the template is not compatible with the built in lightbox.

Non-working reply sounds like a problem in the template. You could try changing Comment Location Settings, Posts and Comments, switch between Full Page, Popup and Embedded and see if that makes any difference.

Kitsune Shan said... [reply]

@MS-potilas Thanks for your fast reply. Unfortunatly I cant find any loop code in the whole theme. I just placed again the code where it should be. Lets see if you can take a look. The only thing I notice is that comments are a bit moved to the right:

kitsunetest.blogspot.com

MS-potilas said... [reply]

@Kitsune Shan Hi, in your template there's line:

#comment-header{float:left;padding:5px 0 40px 10px;margin:5px 0px 15px 0px;position:relative;background-color:#1a1a1a;border:1px dashed #2E2E2E;}

There's that float:left; which causes the surrounding div to be 0 pixels in height. You can try removing that float:left; definition, to make the comments show differently. But the styles might need some more refactoring besides that, too.

Kitsune Shan said... [reply]

@MS-potilas Thanks! at least now I can see "something" :P

I will do some more test with firebug to get some kind of highlight. Maybe not as I want but maybe something closer or at least a highlight line around the comment.

Thanks again ;)

Liezl Ruiz said... [reply]

Hi! How did you make your comments threaded here if you disabled blogger's new threaded comments setting?

Liezl Ruiz said... [reply]

wow, that was a fast reply! thanks.. i actually followed this post. @MS-potilas

Unknown said... [reply]

This particular blog is really awesome

Deepak said... [reply]

NIce Trick :) Visit My Blog also ;) WwW.gofferkart.CoM

unknown said... [reply]

your blog is very nice...

Versionit is the best institute of SAP-ABAP Training institute in Ameerpet,Hyderabad.we will provide both technical and functional SAP-ABAP related courses.

unknown said... [reply]

blog is really awesomeSeo

WJ Info said... [reply]

Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker

Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker


Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker



Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker


Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker

Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker

Download Any Illegal Movies on Jio Rocker Download Now Jio Rocker

Post a Comment

Related Posts Plugin for WordPress, Blogger...
See the hack
for this dynamic
views icon: