Archive: November, 2005

Fixing <MTEntryModifiedDate> in dynamic templates

According to the Movable Type support desk it’s a known bug that <MTEntryModifiedDate> sometimes returns the original publishing date rather than the modification date when used in a dynamic template. I think this must be a regression of the same bug from 2.661 mentioned here, but now it only affects dynamic publishing.

Luckily, the fix is much easier to implement this time. Simply backup /path/to/mt/php/lib/function.MTEntryModifiedDate.php and then edit it so the file looks like this (or download the whole file):

<?php
function smarty_function_MTEntryModifiedDate($args, &$ctx) {
    $e = $ctx->stash('entry');
    $args['ts'] = $e['entry_modified_on'];
    return $ctx->_hdlr_date($args, $ctx);
}
?>

I should probably understand this sort of stuff better (you did backup your current file, right?) before I go hacking around, but I figured that my <MTEntryDate> tags were working correctly in my dynamic templates. Why not just copy the code out of that PHP file (function.MTEntryDate.php), change ‘entry_created_on’ to ‘entry_modified_on’ and see what happens?

Whadaya know, it worked! (With no ill effects, knock on wood.) Now my dynamic Atom feeds have the correct date in the updated field.

Popularity: 6% [?]

Fixing <MTSimpleCommentCount> so it works outside <MTSimpleComments> in dynamic templates

Like my last post this is a small fix to a problem with the PHP implementation of the SimpleComments plugin. The original perl code allowed the use of the <MTSimpleCommentCount> outside of SimpleComments tags. This is really useful if you want to output info on comments or trackbacks based on how many there are. In my case I want the updated timestamp on my individual Atom feeds to match that of the most recent comment or trackback, but if there isn’t any feedback yet, the timestamp should match the modified date of the entry itself.

For some reason (and I don’t know enough about writing PHP plugins for Movable Type to tell you why) the “official” PHP version of SimpleComments returns null if you try to do this. Luckily kate at geekmum noticed the same problem and figured out that installing one file from Rad Geek’s PHP port fixes the issue. So download that package, and copy function.MTSimpleCommentCount.php to /path/to/mt/cgi-bin/php/plugins/ (make a backup of your original function.MTSimpleCommentCount.php, first). Now you can find the total comment and trackback count in dynamic templates to your heart’s content.

One caveat: I believe the official PHP port allows comment counts to be accessed outside the context of a single entry, but Rad Geek wrote his port before that was a feature. So if you’re using SimpleComments to pull a blog or category-wide comment count in a dynamic template, this “fix” will probably break that.

Popularity: 6% [?]

Making SimpleComments aware of TrackBack junk status

Adam Kalsey’s SimpleComments plugin for Movable Type was written long before MT allowed comments and trackbacks to be marked as unpublished, so in its original version it will output junked and moderated feedback. It was also written before MT had dynamic publishing, so of course it didn’t support that, either.

Luckily Brad Choate quickly added dynamic support to the plugin, and recently Joe D’Andrea released a patch that made the static half recognize junk status. So all I had to do was combine the two fixes to make SimpleComments compatible with dynamic templates and junk status aware. Directions follow.

1. Download and install the original SimpleComments package (this includes Brad’s code for dynamic publishing).

2. Apply Joe’s patch to SimpleComments.pl.

3. Apply the following patch to /path/to/mt/php/plugins/block.MTSimpleComments.php:

147a148,149
>     if (isset($args['visible']))
>         $moderation_filter = "and tbping_visible = 1";
153a156
>                $moderation_filter

Or you can just download the patched file and copy it over the original.

Now your combined lists of trackbacks and comments won’t show junk, even if the list is part of a dynamic template. This will be important if you want to follow my directions (post coming soon) for creating dynamic Atom feeds for individual entries.

Popularity: 7% [?]

I’m still coming to terms with my inner Tivo Diva

I hope that’s not a spoiler, buddy.

Popularity: 2% [?]

This is a test

This is only a test of Rae’s new EE trackback system.

(More posts soon, I promise. I’ve set up individual Atom feeds for entries that are very useful for tracking comments, so I’ll be posting a howto.)

Popularity: 3% [?]

I’m all about buying useless gadgets…

But rather than getting one of these to help the Insta-Wife park his new SUV perhaps Glenn could just hang a tennis ball from the ceiling.

Popularity: 3% [?]