July 31, 2006

Broken Links in MT Comment Notification E-mails

I upgraded to the new Movable Type 3.3 a while ago, and for the most part I like it. There are a few enhancements to the interface, just little incremental things that don’t mean much by themselves but when taken together make a big difference. And there’s a lot that’s stayed the same because it already works well, and doesn’t need to be changed.

But there was one big annoyance that really had me rattled. After I upgraded to MT 3.3, all the comment notification e-mails I would get were text-wrapped at 72 characters. Now I know there’s a debate out there about this, some people that say all outgoing mails should be text-wrapped because some e-mail clients don’t know how to handle free-flowing text and wrap it themselves (those PINE users sure are vocal). And if it was just text I wouldn’t mind it being wrapped for me. But MT was wrapping the links in the text too, the links that you click on to edit or approve a comment. I used those links all the time, because no matter how much filtering gets installed I still get spam comments. With those links it only took about two clicks to delete those nasty buggers. But when MT wrapped the text and inserted a line break in the middle of the link, I couldn’t click on it anymore. This added a few more steps to my mission of wiping out spam, but what made it especially bad was that the links were still there, taunting me, visible but broken.

Luckily today I found the fix. And it’s not an easy fix, like setting something in the configuration panel. You have to dig into the source code for Movable Type and make the change there. Which means when MT 3.4 comes out and you upgrade your files, this fix will be wiped out. We can only hope Six Apart will have fixed this bug by then, but it’s still a messy workaround. Here’s how you do it:

Open your FTP and go into your mtadmin folder, or whatever you named it. Drill down into the /lib/MT/App directory and look for two files, Comments.pm and Trackback.pm. Each of them contains a line that handles the text wrapping that you’ll need to comment out. This is what the line looks like:

$body = wrap_text($body, 72);

You’ll want to open each file and change the line so it looks like this:

# $body = wrap_text($body, 72);

In Trackback.pm, that code appears on Line 420. In Comments.pm, it shows up twice, on Line 198 and Line 614. Comment out all three of those occurrences, then save the files and upload them back to your server. This should fix the text wrap on future e-mails.

I hope Six Apart addresses this in a future release. It’s pretty bad to put a link in an e-mail and then make it so you can’t click on it. Their programmers are usually better than that.

Tip found at http://www.sixapart.com/movabletype/forums/index.php?showtopic=54652 (which isn’t working right now…check out Google’s cached version).

Filed under The Computer Vet Weblog

Comments (1)

Comments RSS - Write Comment

  1. Jay Allen says:

    Hi there. You’re absolutely right. That’s a bug that needs to be fixed and one we missed in both our QA and beta testing. I guess with all the attention on Activity Feeds, testers had stopped using comment/TB notifications. I know I did.

    Anyhow, you’ll be happy to know that we’re going to be issuing a bug fix release this month which includes a fix for this problem.

    Anyway, sorry about the inconvenience and thanks for using Movable Type!

    Jay Allen
    Product Manager – Movable Type
    Professional Products Group
    Six Apart

    Posted August 5, 2006 @ 5:23 pm

Write Comment