Greet First Time Commentators without a Plugin

Some time back, we had seen how a Simple Fast Forward Button can show how much you respect your reader’s time. (get it here) Today, I just tweaked some code so as to say hello to first time commentators. No, this is not about those plugins that send an email when they comment, in fact this is not about any plugin.

Here is a screenshot of what the result will look like…

Hello Dear Commentator! Its good to see your here!

Usually, when a comment is held for moderation, you get the message ‘Your comment is awaiting moderation’. Well, this doesn’t help us much; some may not even understand what that mean. The idea is to edit that default message and display a friendly hello message as above.

Say Hello to First Time Commentators

The default text ‘Your comment is awaiting moderation’ is inside a file comment-template.php. We are going to edit this file, replace the text with our new message and tweak the position of the message so that it looks good. Follow the steps.

Find the file: the file comment-template.php is in the wp-includes folder of your WordPress installation.

Download it: Bring the file to your computer via your favorite FTP program.

Backup the file: Save a copy of the file securely. (Backups don’t mean that you are going to make errors, it’s just the part of a standard procedure.)

Find the text: Open comment-template.php in a text editor and search for ‘moderation’. You will end up with a line like this on line number 1229 if you haven’t edited the file before.

<em><?php _e('Your comment is awaiting moderation.') ?></em>

Write your message: Replace the text ‘Your comment is awaiting moderation’ with your own custom message. You can use the standard html here like line-breaks and italics. By default it takes the style from your style sheet. Make sure that the message is more general because at times comments from old commentators will also go into moderation. They might be annoyed to find you thanking them for their first comment.

Tweak the Code: If you save the file after the last step, the message will come after the name of the commentator as below.

The Greeting Message goes Below the Name. Confusing.. right?

So move the line you just edited to above the name of the commentator in the comment-template.php file . The final code will look like

[sourcecode language='php']
< id=”comment-“>

div id=”div-comment-“>

comment_approved == ’0′) : ?>



%s says:‘), get_comment_author_link()) ?>
[/sourcecode]

Enable Comment Moderation: Go to your wordpress admin > Settings > Discussion and tick the box that reads ‘Comment author must have a previously approved comment’. By enabling this all the comments of first time commentators will be held in a moderation queue, even if it doesn’t contain any link or spammy content.

That’s it! Oh, if you don’t like to have the fun of editing the code yourself, just copy and paste the above code replacing the appropriate code in the file. If you have an editor like Notepad++ that shows you line numbers, then replace the code from lines 1220 to 1230 with the above code.

Wish to see a working demo? Try leaving a comment here! :P

Update: Kim raised an issue regarding this method. She pointed out that, when WordPress updates the core files (i.e. when we move from WordPress 2.7.1 to 2.7.2 and so on..) they might replace the comment-template.php file. So we will have to do it all over again. Though wordpress won’t be replacing the file with every update, we will have check if its working each time. So thats one limitation of this tweak. She have written a related article which the code lovers will enjoy reading. Check it out. Thanks Kim!



You May Also Like To Read:

  1. Remove Admin from Recent Comments List (No Plugin)
  2. Add Custom Status or Notes to a Post without a Plugin
  3. How To Create Short URL’s on your WordPress Domain without a Plugin or Script
  4. Add a Fast Forward Button to Respect Reader’s Time
  5. If you have 1000+ comments awaiting moderation, this is for you

This entry was posted in WordPress and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

For More Like, "Greet First Time Commentators without a Plugin"
Grab the Feed or,

29 Comments

  1. Posted March 2, 2009 at 07:43 | Permalink

    Another great tip, Arun! Thanks for all of these. On my particular site, I don’t hold comments for moderation, but I can see where this will come in handy for other blogs! :-)

    • Posted March 2, 2009 at 17:24 | Permalink

      Thanks dude,
      I think wordpress admin should include an option to let the bloggers decide what text to display. Then we wouldn’t have to touch a bit of code.
      But there is going to be an issue when wordpress updates its files (suggested by Kim). We would have to redo all these again. But that would be only once in a while because wordpress wouldnt replace all the files in every udpate. Only when this purticular file is updated we would have to worry, though we will have to keep an eye for it with every update.

      Cheers!

  2. Posted March 2, 2009 at 10:35 | Permalink

    You tutor,
    This is excellent tip from you!

    See ya

    -girish

  3. Posted March 3, 2009 at 09:15 | Permalink

    Great boss!
    I’ll use it in my blog too

  4. Posted March 3, 2009 at 10:04 | Permalink

    Arun,

    Thanks for the mention :-) That is a great tip too. There’s so much that can be done when you edit the core files. I would need to make a list of my changes because overtime I would forget what I edited. Another drawback to editing the core files is when you work with clients – they aren’t going to want to worry about these files and are going to call in a panic if an upgrade wipes out their customizations.

    • Posted March 3, 2009 at 19:22 | Permalink

      Yeah, thats right, when we work for clients we wouldnt want that to happen. But basically, such tweaks are aimed at those freaks who would love to tweak their theme to the limits. For those who love handling codes, this is going to be fun.

      Afterall, being able to edit the core files is the true spirit of a Open source Blogging platform!

      But I had never thought of the upgrade issue before you said it. Now I have to make a list of tweaks I have done too!.
      Kudos to you, Kim!

  5. Posted March 4, 2009 at 21:28 | Permalink

    Thanks for this tip.That really shows how innovative you are.Keep the good work.I will also implement the same.

    • Posted March 5, 2009 at 00:47 | Permalink

      Also make sure that you track the wordpress updates to find if they have changed the file you are going to edit now. I will be posting them (if any) here as updates when a new WordPress Update comes by!

      Enjoy the tweak!

  6. Posted March 5, 2009 at 10:46 | Permalink

    Hey
    I got an email reg the first comment!
    Is it automated or you sent manually ?

  7. Posted March 11, 2009 at 16:25 | Permalink

    Very simple but really good thing to have a custom message. It helps a lot.

    • Posted March 11, 2009 at 22:29 | Permalink

      Someone asked me once, “what does ‘Your comment is awaiting moderation’ mean”. This is my answer!

  8. Posted March 12, 2009 at 12:31 | Permalink

    Nice Tip Arun

    • Posted March 12, 2009 at 18:41 | Permalink

      ah, I guess you just enjoyed a live message! Glad that it worked with you! ;)

  9. Posted March 19, 2009 at 04:12 | Permalink

    Ok let me see your msg…

  10. Posted March 19, 2009 at 04:13 | Permalink

    h.mmm…. its cool

  11. Posted April 1, 2009 at 18:26 | Permalink

    Should I use tag for introducing a text in new or next line ? ;)

  12. Posted April 1, 2009 at 18:27 | Permalink

    I meant Break Tag ! :)

    • Posted April 2, 2009 at 16:55 | Permalink

      I am not clear with your question, if you are talking of the break line tag, you can use it anywhere. Try it out…

  13. Posted April 6, 2009 at 06:11 | Permalink

    But it doesn’t fit in my blog. ‘Your comment is awaiting moderation’ appears somewhere below the gravatar on the left site in light colors. So I doubt whether the commenter has even observed that. So this won’t make a difference to me. But for blogs like yours, it does matter.

    • Posted April 6, 2009 at 12:56 | Permalink

      No, I think you are a bit wrong, I saw that message last time I commented. But you dont have space to put a long message like I have, a short one will still work :)

  14. Pauro
    Posted May 14, 2009 at 21:18 | Permalink

    right on the spot,thank you……..

  15. Posted December 5, 2009 at 20:43 | Permalink

    Wow! Something that’s innovative & never thought of, encouraging a new commentator. Awesome one, Arun.

    • Posted December 6, 2009 at 05:32 | Permalink

      Hey, thanks. btw, I think you didnt see it in action here. I hadnt updated that after the last wp upgrade ;)

  16. Posted March 18, 2010 at 11:33 | Permalink

    Thanks for this amazing post. I never thought how much this can affect the users experience on my blog.

    Glad I changed it today ;)

One Trackback

  1. [...] Greet First time Commentators without a Plugin [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

  • Get Free Updates