Saturday, 9 July 2005

Blogger - how to edit comments






UPDATE please note that on New Blogger, rolled out fully in May 2007, you can no longer edit comments. I'm leaving this post up just for historical interest.

Editing comments posted using Blogger's own commenting system is impossible, Blogger say.

Well, no. It IS possible.The ingenious idea/insight comes from the one and only Truckspy, and this post is brought to you by the Truckspy/Improbulus Magical Sheep team...

[Edited 17 August 2005] So, to edit comments on Blogger there are three ways:

1. Edit an individual comment on a one off basis, or
2. If you use Firefox, use Browservulsel's Greasemonkey user script (for more information and instructions, please see this post), or
3. Add simple code to your blog template to produce an "Edit" link by every comment, effectively enabling one-click editing of any comment.

I'll start with the last - it's the neatest solution, and works for all browser types.

Finding out your Blog ID

Before you can do either, however, you need first to find out your blog's ID, a number unique to your blog. See this page for how. Note that down, better still copy it for easy pasting.

Adding an Edit link to your template

For this solution you need to take one more preliminary step - find out your blog's admin and PID numbers. See this post for more info on how. (If you have enabled conditional new post links, you already have the info you need and you can just copy it wholesale).

Next, you just add this code to your blog template (changing XXXXXXXXXX to your blog's admin number, YYYYYYYYYY to your PID number and ZZZZZZZZ to your blog's ID number) - you'll notice the first section is what you use for conditional new posts on Blogger:

<span class="item-control admin-XXXXXXXXXX pid-YYYYYYYYYY"><a href="http://www.blogger.com/post-edit.g?blogID=ZZZZZZZZ&postID=<$BlogCommentNumber<span class="item-control admin-XXXXXXXXXX pid-YYYYYYYYYY"><a href="http://www.blogger.com/post-edit.g?blogID=ZZZZZZZZ&postID=<$BlogCommentNumber$>">Edit Comment</a></span>
amp;gt;">Edit Comment</a></span>

(Of course you can change the "Edit comment" link text to just "Edit", or "Edit this sucker", or whatever you like!)

That's it. When you are logged in to Blogger and then view your blog, in each individual post (but only on the post page/item page for the post, depending on how you've got your template set up) you will see, against each comment, not only the usual Blogger "Delete" icon, but also a new link "Edit Comment".

When you click that link it calls up a page which looks just like Blogger's "Create post" form, with the existing comment text in the box where you'd usually write your post. (The comment box even has a "Title" textbox above it but neither Truckspy nor I can figure out what it's for, filling it in doesn't do anything, but (at least in Firefox) if you have the title field cursor active as if you were going to type something in the Title box, and hit enter on the keyboard, it seems to delete the entire comment - so best not to go click in or otherwise go near the Title box!).

Edit the comment to your heart's content, then click Publish Post, and voila - comment duly edited. BUT BE WARNED THAT YOU TRY THIS AT YOUR OWN RISK - IT IS REALLY, REALLY EASY TO ACCIDENTALLY DELETE A COMMENT EVEN WHEN YOU DON'T THINK YOU'VE GONE NEAR THE TITLE FIELD, so if you've clicked "Edit Comment" just to experiment and you have no intention of deleting that comment, publish it with the existing text anyway when you're done, or close that window without doing anything. So don't say I didn't warn you - I've gone and accidentally deleted one comment myself, today (sorry, Otis!).

You'll notice that if you view your blog without being logged in to Blogger, you won't see the Edit Comment link (or Delete link) - and neither will anyone else reading your blog. Which is the point of the admin and PID bits; you don't want other people to see the Edit Comment link (even though they shouldn't be able to do anything with it unless they're logged in with your proper login/password, it's just neater to hide it from those who can't use it).

One-off editing

The manual way, if you want to edit a single comment without tweaking your code, is first to make sure you're logged in to Blogger, then go to the post page with the comment you want to edit, then view source.

Find that comment in the view source. Towards the start or end of the comment, depending on how you've got it set up, there will be a long number hidden in the code, something like <a name="AAAAAAAAAA"> or <a href="#AAAAAAAAAA">. Note that number down or ideally copy it to your clipboard. It's the "Post ID" for that comment.

Next, go to this URL (where ZZZZZZZZ is your blog ID that you already found out earlier, and AAAAAAAAAA is the number you just noted down, the post ID):
http://www.blogger.com/post-edit.g?blogID=ZZZZZZZZ&postID=AAAAAAAAAA

Or, you can just fill in the blog ID and post ID in the form below and hit the Edit Comment button:





And it will call up the page I mentioned above, which looks like a Create Post page but actually enables you to edit and save the comment text.

Again try this at your own risk - you have to be really careful you don't accidentally delete the comment, as mentioned before, no comeback on Truckspy or me if you do!

[Edited 17 August 2005] Finally, for the method using a Greasemonkey script for Firefox, which just involves a few clicks to install the script, see this post.

UPDATE please note that on New Blogger, rolled out fully in May 2007, you can no longer edit comments. I'm leaving this post up just for historical interest.


Technorati Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

46 comments:

SatishTalim said...

As usual, a very helpful post. Thanks.

ChickyBabe said...

That's so cool! I always wondered if I could do that. Now to find the time and try it....Thanks again for another useful post :).

Steve said...

Thank you, that's a very helpful post. I used it immediately.

TaB said...

dang.. but wut a pain to do.. you would think blogger would have this huh? i really like their cmt system too.

as usual though top notch post.

Improbulus said...

Thanks for the comments. You can blame Truckspy for this post!

Absolutely right Tab, Blogger should have this built in.

Sudar said...

Thanks Improbulus, that's a very helpful one..

BTW it would be nice if you could find out how to list all the comments that i have made in other blogger blogs, so that i can keep track of them.

Am i demanding too much...?

mumsgather said...

Hey! This is a really useful and cool tool. I just tried it out and it worked great! I'm going to bookmark this page immediately. Thanks a lot!

andrew landeryou said...

great tip
I use it all the time

Improbulus said...

Glad you like it, Sudar, mumsgather and Andrew, thanks for the comments.

Sudar - it would be good, what you suggest, but I don't know how yet. May get Truckie on to it! :-D

RedRyder said...

Yes Sudar..you are demanding too much. :-)

From everything I know about it that would be impossible ( I hate to use that word but ) the way things are setup with Blogger as of now.

Improbulus said...

If Lord Truckie says it, then believe it! Sorry Sudar, maybe if enough people have requested it in their recent survey, Blogger might introduce it...

Singpolyma said...

Have you seen the nifty <$BlogID$> template tag that gets rid of the need to enter BlogIDs manually?

RE: tracking comments in blogger blogs -- nothing automatic to do stuff like this has ever crossed my path -- hence the creation of Commentosphere, who's purpose this is

Improbulus said...

Thanks singpolyma, very handy to know that, and it's not documented in the Blogger Help.

Commentosphere is a cool idea too.

noir169 said...

Ermmm... This might sound weird but can I know where exactly in my template I'll have to add the script to make it work? I've tried many times but to no avail. Still can't get it to work :(

Improbulus said...

Hi noir169, sorry for the delay, have been exceptionally busy of late.

You just add the script between the <Blogger> and </Blogger> tags, by the code for the comments - I have mine just after the <$BlogCommentDeleteIcon$> code, if that helps?

Sharon J said...

I've put the code into my template exactly where it was explained in the above comment but it isn't working. Any idea why? ~Sharon J

Improbulus said...

Sharon, I don't know why, but I can't see it in your template. Are you sure you saved the template AND republished it after adding the code, and did you doublecheck that you definitely entered the correct PID number and blog ID number for your blog?

debambam said...

Excellent tips thankyou. It did take me a while to find the right id numbers but got there in the end! I do have greasemonkey script for this but it doesn't always work. Now I can edit the the comment to reply directly to it!! I'll be linking this page and posting about it tomorrow (today is wordless wednesday!!)

Improbulus said...

Glad to have been of help debambam and thanks for the link (on Talkative Thursday, I presume)!

Sharon J said...

Sorry. I took it out again when it wasn't working. I'll have another go when I get the time and come back to you. Thanks. Sharon

Improbulus said...

Good luck with that then Sharon, let me know how it goes.

Anonymous said...

can I edit this?

Improbulus said...

Anon, there are only 2 ways to edit comments made on a Blogger blog.

1. You sign up for a free Blogger account (you can use it just to comment on other blogs, you don't have to start a blog yourself). When you want to comment on a Blogger blog, you should sign in to Blogger first and comment via that ID if you want to be able to edit the comment. Then in future, when you go back to that comment, you will have the option to delete it via the pencil icon.

2. You have your own Blogspot blog and have follow the instructions above. Then you can edit comments that anyone (including yourself) have made on your own blog. The person who wrote the comment still can't though, unless it's you, or unless they made the comment via Blogger, signed in.

Hope that helps.

Priya said...

Hi Improbulus,
I added your script and it works beuatufully. Thanks a lot for the detailed explanation.

Improbulus said...

Thanks for your comment priya, glad it works for you!

Àñìkét §®ívá§tàvâ said...

hey improbulus. i'm also having the same problem gettin this to work.. in one of my blogs, when i put this tag next to <$deleteicon$>, it doesn't appear, and same happens with another blog.. but in the first blog, when i put it next to <$backlinkdeleteicon$> it works. n in my second blog, there's no backlink tag.. please can u help me solve this problem.. my blogs are www.testmatsoc.blogsot.com and www.matsoc.blogspot.com . i'll be puttin the tag without the span so that if atall, its visible to you as well.. though it might not work.
Aniket

Wystful1 said...

This is just SOOOOOOOOOOO cool! Thanks. I've been trying to make my own, and to no avail. I've done google searches for hacks of this sort, also to no avail!

I've wanted to have a 'reply' button so I can go in and 'reply' to the comments. And this just works perfectly.

Thank you, thank you. From the bottom of my heart.

Improbulus said...

Aniket, the first blog whose URL you gave doesn't seem to have the edit comments code in it at all. The second blog seems to have the correct format of code so I don't know what to suggest. Perhaps you could try Blogger Forum, which has more people with lots of good ideas? Have you tried the Greasemonkey userscript for editing comments?

Wystful1, thanks for your comment, glad you found this useful. Sadly it doesn't seem to work for the new Blogger Beta, but we'll see if a way round that can be found...

Newbie said...

"For this solution you need to take one more preliminary step - find out your blog's admin and PID numbers. See this post for more info on how."

Well "this post" doesn't explain that, at least in any kind of obvious way. Help! Thank you.

Newbie said...

OK so I'm a little slow but I finally figured it out.

Very handy item! Thanks!

Anonymous said...

Is there any way to edit posts on others owned blogs?
I stupidly signed a comment with my flatly writed email address and would correct in order to avoid spamming...
thanks
please reply to:
error { at } interfree { dot } it

Improbulus said...

Newbie, glad you figured it out!

Error, sorry I don't think so - if you're logged in, on some blog platforms maybe you could edit, but most just let you delete (if you're logged in), if at all - not edit. That's why it's good to be logged in when you comment. Plus with the new Beta they've closed the editing loophole so NO one will be able to edit comments, not even the blog owner. (And I no longer reply by email.)

linus said...

Hello

It doesn't works in blogger beta.

thanks, bye.

Improbulus said...

Hi Linus, no sadly it doesn't work in Beta as I said at the end of this post. Blogger have fixed it so that the blog owner can no longer edit comments, or at least made it more difficult to figure out how to do it! Which many people would say has to be right as arguably the owner shouldn't be editing other people's comments.

What I'd like though is to be able to edit my own comments, with maybe a short time window after posting in which to do it in, see this post.

Shrish said...

Donn't in 'New Blogger'. :(

Is there any workaround for New Blogger.

Improbulus said...

Shrish, Blogger Beta is now New Blogger and as mentioned on that, no, I don't know of any workaround, sorry.

rdcimafranca said...

Hi, is there a way to track anonymous comments? maybe get an IP address? seems not doable from the users end though would be helpful for some

Improbulus said...

rdcimafranca, I don't know of any, sorry. Bloggger may well track their IP addresses but they don't make it available to us users as far as I know.

boardtc said...

i could not find out what admin-XXXXXXXXXX should be replaces with on that page, i tried my blogger (admin) login id and then cu and paste the code before the </body> in edit template and get:

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The reference to entity "postID" must end with the ';' delimiter.

How can I get this working? Thanks.

Improbulus said...

Boardtc, unfortunately there's no point looking for the correct admin- number in this case, as Blogger no longer allow editing of comments - they've closed this loophole. I've updated the post to make that clear.

Anonymous said...

Very useful blog. But please help me, can i put a commentary form in my blog http://famouspharaohs.blogspot.com

SEO Pune said...

going well ....Blogger Beta is New Blogger and it have to more facility then older one...

Rukhpar Mor said...

Can't make the manual one work=(!!

Slim said...

Works Great on my Blog!

Took a while to get it working, but now it's working great.

Thanks, so much!

Anonymous said...

Great information

Keep up the good work

Kiran said...

hey, help plz...@admin : Where to find admin id on blogger and where to place the code above?

Plz atleast tell where to find admin id ?

- thank you