Need someone to lead product or development at your software company? I lead product and engineering teams and I'm looking for my next opportunity. Check out my resume and get in touch.

Comment notification hack

Freshness Warning
This article is over 17 years old. It's possible that the information you read below isn't current.

I find it irritating that each time I reply to someone’s comment on this site I receive an email notifying me that I’ve posted a comment. I like getting the notifications when someone else comments, just not when I comment.

So I opened up the MT source code and fixed it. Now when I add a comment, I don’t get the email.

Open lib/MT/App/Comments.pm and find the line that says MT::Mail->send(\%head, <<BODY);. (It’s line 123 in MT 2.21) Change it to read MT::Mail->send(\%head, <<BODY) unless $author->email eq $comment->email;

Now the author of a post won’t receive a comment notification if the commenter’s email is the same as the author’s.

francesco
October 3, 2002 4:58 AM

it didn't work for me... when i chsnge the code above and then try to open my popup-comment-window i get this: An error occurred: syntax error at lib/MT/App/Comments.pm line 145, near "}" (Might be a runaway multi-line << string starting on line 124) Compilation failed in require at mt-comments.cgi line 21.

Adam Kalsey
October 3, 2002 9:35 AM

It sounds like your code is incorrect. Make sure you don't have a semicolon (;) before the "unless" and that you do have one at the end of the line. You might want to copy the code directly from this page and paste it into your code. All the code should be one a single line. If there are line breaks, remove them.

Kymberlie R. McGuire
October 25, 2002 11:37 AM

Awesome! Thanks!

patricia
February 16, 2003 6:01 AM

I just upgraded to MT 2.6 and ran into trouble when I tried hacking the comments.pm file. For this to work in 2.6 the line should read... MT::Mail->send(\%head, $body) unless $author->email eq $comment->email; It's just a small change from << to $ in front of 'body'. Just thought I'd pass the info along.

Trackback from Through the Looking Glass
August 18, 2003 5:34 AM

Comment hack

Excerpt: If you're using Moveable Type, this is an extremely useful hack - by simply replacing a line in the code, you can still be notified by e-mail when someone comments on your site, but you won't receive the e-mail when...

Jon Hicks
October 2, 2003 3:19 PM

Thanks for this hack! Worked a treat! (Its on line 152 in 2.6...)

Trackback from izzy|wizzy
October 12, 2003 6:57 PM

Ban Those Spam Comment IPs

Excerpt: Intrigued by a comment Kristine made on this post over at mentalized, regarding adding a delete comment link to the emails that MT automatically sends when a comment is added, I dug into MT a little to discover how to...

Trackback from ShawnAllison.com
October 15, 2003 11:03 AM

Comment Notification Hack for Mt-Blacklist

Excerpt: This is my first attempt to share I hack I've made based on a few others hacks around the web. It worked for me but...

Trackback from PromoGuy dot Net
October 16, 2003 9:19 AM

Blacklisted and Tweaked

Excerpt: 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.

Trackback from nf0's Life
October 21, 2003 6:35 AM

Nightly Link Dump

Excerpt: Sony Ericsson: P900 Possibly my Next phone, once it works with a Mac Wired News: TV on DVD: What's the Difference? I think its crapy, and just something else wrong with the music industry. I read that the new Roswell DVD's have the music replaced. I t...

asb
October 24, 2004 8:51 PM

Has anything been done to fix this for MT 3x? I'm getting sooooo tired of getting my own comments. I'd really appreciate an answer and I'd more appreciate a posted fix! Thanks.

heather
January 30, 2005 6:05 PM

i don't know how dirty it is, but i changed lines 471 and 472 in lib/MT/App/Comments.pm (MT-3.15) from: MT::Mail->send(\%head, $body) or return $app->handle_error(MT::Mail->errstr()); to MT::Mail->send(\%head, $body) unless $author->email eq $comment->email; # or return $app->handle_error(MT::Mail->errstr()); to get rid of the annoying self-comments. i'm sure you could just use a filter in your email app, too.

Kristina
March 23, 2005 10:10 PM

Heather's mod worked for me. thanks heather and adam!

Jennifer
April 22, 2005 1:05 AM

FYI, if you would like to do this in MT v.3.1x and have MT-Blacklist installed, the file to modify is called Submission.pm, located in your plugins folder: plugins/Blacklist/lib/Blacklist/App/Submission.pm Around line 797 (almost the very bottom of the file) you can use Heather's mod above. Seems to work for me. Hope someone else finds this useful!

eli
January 13, 2006 8:46 AM

FYI, its lines 578-579 in MT 3.2

These are the last 15 comments. Read all 17 comments here.

This discussion has been closed.

Recently Written

A framework for onboarding new employees (May 15)
There’s no single good way to onboard an employee that works for every role. Here's a framework for creating a process that you can adapt to each situation.
TV hosts as a guide for software managers (May 10)
Software managers can learn a lot from journalists or late night TV hosts and how they interview people.
The Improvement Flywheel (Apr 29)
An incredible flywheel for the improvement of a development team. Fix a few things, and everything starts getting better.
Managers and technical ability (Dec 26)
In technical fields, the closer you are to the actual work being done, the closer your skills need to resemble those of the people doing the work.
Dysfunctions of output-oriented software teams (Sep 17)
Whatever you call it, the symptom is that you're measuring your progress by how much you build and deliver instead of measuring success by the amount of customer value you create.
Evaluative and generative product development (Aug 30)
Customers never even talk to the companies that don't fit their needs at all. If the only product ideas you're considering are those that meet the needs of your current customers, then you're only going to find new customers that look exactly like your current customers.
Product Manager Career Ladder (Aug 19)
What are the steps along the product management career path?
Building the Customer-Informed Product (Aug 15)
Strong products aren't composed of a list of features dictated by customers. They are guided by strong visions, and the execution of that vision is the primary focus of product development.

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2020 Adam Kalsey.