scriptygoddess

06 Sep, 2003

More Meaningful Comment Notifications

Posted by: Jennifer In: MT hacks

I wanted to change how my blog comment notifications looked. Since I only have one blog, I don't need the first part to tell me which blog the comment is from. I also wanted to do whois lookups on the ipaddresses so I can get more info about the people who are commenting on my site.

Here's what the original email looks like:

Subj: [PromoGuy dot Net] New Comment Posted to '7 x 14 + 2 = 100 Things
Aboot Me'
—————————————————————-
A new comment has been posted on your blog PromoGuy dot Net, on entry #1489
(7 x 14 + 2 = 100 Things Aboot Me).
http://www.promoguy.net/archives/001489.php
IP Address: 123.45.678.90
Name: Lisa
Email Address: SomeMail@SomeDomain.net
URL: http://www.snarkypants.com

Comments:
Hey! Where's the rest?? You promised! :) Slackerboy!

After my modifications, my Comment Notifications look like this:

Subj: [7 x 14 + 2 = 100 Things Aboot Me] by "Lisa" – PromoGuy dot Net
—————————————————————-
"Lisa" left a new comment in your blog PromoGuy dot Net, on entry #1489 (7 x
14 + 2 = 100 Things Aboot Me).
http://www.promoguy.net/archives/001489.php
IP Address: 123.45.678.90
IP Info: http://www.samspade.org/t/lookat?a=123.45.678.90
Name: Lisa
Email Address: SomeMail@SomeDomain.net
URL: http://www.snarkypants.com

Comments:
Hey! Where's the rest?? You promised! :) Slackerboy!

My changes reflect my preferences, yours may be different.

1. I don't need to see "New Comment Posted to" in my subject line. It takes
up too much space, and my web mail program won't show full subject lines, so I
need the important stuff first. Besides, by looking at the Brackets I recognize
that it is a comment notification.

2. I want to know which post got the comment, so I put that first. I don't
need to know which blog it is from, because I only have one – so I moved that
part to the end. Plus, I wanted to know Who sent the comment.

3. On heavy comment days, my inbox is nearly bursting. Now when I see a
comments is posted by a certain person, I can go to read that one first.

The only major change in the Body was making the IP Address into a clickable
link to do a WHOIS and TRACEROUTE on SamSpade.com. I added a new line for that.
I also slightly changed the wording on the first sentence.

Here is what I did. Again, once you see the changes I made, you will probably
want to customize it the way you want it to look. Please note: This code was
tested and executed on MoveableType 2.64.
I don't know if it will work on
lower versions, so YMMV.

Disclaimer: Do this at your own risk. It should go fine, but you never
know. I won't be responsible for fixing it if you go and screw it up.

First, FTP or otherwise navigate to your MT installation directory and find:
/lib/MT/App/

Now, make a backup copy of Comments.pm (always make backups, yo).

Open up Comments.pm in your favorite text editor (I use
araneae; for simple jobs
like this).

Go to Line 132 or search for "$author->email" (without the quotes) and you
will be close.

Be sure you are on the line that says "Subject =>" and we are ready to get
jiggy!

Highlight and delete:

Subject => '[' . $blog->name . '] ' . $app->translate('New Comment Posted to \'[_1]\", $entry->title));

Replace it with:

Subject => '[' . $entry->title . '] ' . $app->translate('new comment by "[_1]" – [_2]', $comment->author, $blog->name)
);

Now if you want to Tweak the Body of the message, scroll down to about Line
146.

I edited the body of the text to lead with the Comment Author's name. So
change this:

my $body = $app->translate('A new comment has been posted on your blog [_1], on entry #[_2] ([_3]).', $blog->name, $entry->id, $entry->title);

To this:

my $body = $app->translate('"[_1]" left a new comment in your blog [_2], on entry #[_3] ([_4]).', $comment->author, $blog->name, $entry->id, $entry->title,);

If you want to investigate their IP address, put your cursor right under

$app->translate('IP Address:') . ' ' . $comment->ip . "\n" .

and hit enter, making a blank line.

Now copy and paste this:

$app->translate('IP Info: http://www.samspade.org/t/lookat?a=[_1]', $comment->ip) . "\n" .

Save the file, making sure it has the .pm extension. Save it back to the same
directory, overwriting the current Comments.pm. (because you already have a
backup, right?).

Now go leave yourself a comment. See how much more meaningful those Comment
Notifications are?

12 Responses to "More Meaningful Comment Notifications"

1 | bhw

September 10th, 2003 at 2:48 am

Avatar

AWSOME!

I have a naughty word in my blog title. I don't mind getting the standard notification, but if I wanted to reply to a commenter, I always had to remember to remove the blog name from the subject line so they didn't get nasty words at work.

It works with 2.63, btw.

2 | bhw

September 10th, 2003 at 3:00 am

Avatar

One problem: the IP link thingy isn't working. Here's the error message I get

An error occurred: syntax error at lib/MT/App/Comments.pm line 146, near ";" syntax error at lib/MT/App/Comments.pm line 146, near "->ip) " Compilation failed in require at mt-comments.cgi line 21.

I edited it twice to make sure I was copying the code from your example correctly. Any ideas?

3 | Promo

September 10th, 2003 at 9:18 am

Avatar

I compared the IP portion above to my code, and there seems to be an extra semi-colon (;) in this post where it shouldn't be.

In this line:
; $comment->ip) . "\n" .

Delete the semi-colon and see if that fixes it. If it works, I will have Jennifer update this post.

4 | Thoughtprints

September 22nd, 2003 at 1:21 am

Avatar

Neato!
I saw instructions over at ScriptyGoddess on how to make More Meaningful Comment Notifications, and I think it is very cool! It's extremely easy to make the changes required, and…

5 | PromoGuy dot Net

October 16th, 2003 at 12:20 pm

Avatar

Blacklisted and Tweaked
MT-Blacklist appears to supercede any mods you've made to comment notifications. Here are a few links to work-arounds, plus a few other Comment Notifcation Mods you may want to try, and some nifty hacks I found along the way.

6 | PromoGuy dot Net

October 16th, 2003 at 12:35 pm

Avatar

Blacklisted and Tweaked
MT-Blacklist appears to supercede any mods you've made to comment notifications. Here are a few links to work-arounds, plus a few other Comment Notifcation Mods you may want to try, and some nifty hacks I found along the way.

7 | PromoGuy dot Net

October 16th, 2003 at 12:37 pm

Avatar

Blacklisted and Tweaked
MT-Blacklist appears to supercede any mods you've made to comment notifications. Here are a few links to work-arounds, plus a few other Comment Notifcation Mods you may want to try, and some nifty hacks I found along the way.

8 | PromoGuy dot Net

October 16th, 2003 at 12:38 pm

Avatar

Blacklisted and Tweaked
MT-Blacklist appears to supercede any mods you've made to comment notifications. Here are a few links to work-arounds, plus a few other Comment Notifcation Mods you may want to try, and some nifty hacks I found along the way.

9 | UtterlyBoring.com

December 21st, 2003 at 8:22 pm

Avatar

UtterlyBoring.com To-Do List
I'm posting this here, most for my own benefit, but for yours as well, so I can make sure I'm getting things changed/fixed on this site and you can suggest…

10 | UtterlyBoring.com

December 22nd, 2003 at 4:32 pm

Avatar

UtterlyBoring.com To-Do List
I'm posting this here, mostly for my own benefit, but for yours as well, so I can make sure I'm getting things changed/fixed on this site and you can suggest…

11 | UtterlyBoring.com

December 23rd, 2003 at 1:41 am

Avatar

UtterlyBoring.com To-Do List
I'm posting this here, mostly for my own benefit, but for yours as well, so I can make sure I'm getting things changed/fixed on this site and you can suggest…

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements