Archive for the ‘MT hacks’ Category

Yearly Comment Leader Script

Tuesday, December 23rd, 2003

I just implemented the comment leaderboard script available here, but I wanted to feature the *yearly* comment leaders as opposed to the monthlies. I tinkered with it and lo and behold, it actually worked!
(more…)

Don’t Be a Spammer!

Tuesday, November 25th, 2003

Last weekend, I had to deal with almost 4,000 bounce messages that were sent “from” my domain. I blamed it on someone using my domain for the reply to address, but now I wonder if it wasn’t a new version of spamming through MT. “Mail This Entry” used for spam - “If you are using Movable Type’s “Mail This Entry” feature on your blog, you are advised to rename your mt-send-entry.cgi file, or remove the feature entirely. If you are not using the feature on your blog, you still need to either rename the script, disable it by changing the permissions, or remove it from your server altogether.” Read all about it at Girlie Matters.

Comment Notification Hack for MT-Blacklist

Wednesday, October 15th, 2003

On October 13th, the MT-Blacklist plugin was released by Jay Allen. However, I found that the Blacklist.pm conflicts with the Adam Kalsey comment notification Hack.

There is a simple way of fixing this small error if you do not want to receive e-mails of your comments. It worked for me but I can’t guarantee it will work for you. If you try it, make sure you back up the original files you are modifying before attempting. I don’t suggest this to novice MT users.
(more…)

More Meaningful Comment Notifications

Saturday, September 6th, 2003

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.

(more…)

Author’s RSS Feed field in comments

Thursday, June 12th, 2003

A while back Chris had asked about getting an extra field in the comments form. At the time all I could do was figure out a way to get the field emailed to you. But thanks to a few lessons I learned in the last script/MT-hack I wrote - I’ve figured out how to do it all. So this is part MT-hack and part plugin.

Here’s a summary of what this does:

You add a field in your comments form to collect RSS feed’s from your commenters and then you can display it back in your comments on your site - just like you do with their blog-URL.

What’s involved:

You’ll be editing any template you use that displays comments or the comment form, and install a plugin (which is as simple as uploading a file to your site) As well, You’ll need to edit two MT files and the mt-database. If you’re not comfortable doing this - I suggest you set up a test MT install and play with this first.

Here is the download for the plugin. The tags associated with the plugin will not work on their own - you’ll need to follow all of the instructions (below).

Some credit notes: A MASSIVELY HUGE THANK YOU to “Milbertus” (A.) of milbertus.com for writing the plugin for the MTCommentFeed tag (MTCommentPreviewFeed tags still in development at this time) (I wrote the plugin for the MTCommentIfRSS tag. w00t!)
(more…)

Edit this entry - right now!

Sunday, May 18th, 2003

This was an item cooked up by Lynda of digitalwoe.com but her original entry appears to be lost and this hack is so handy, I wanted to make sure it was readily available to anyone who wants it. You need to be using PHP to use this - just insert the code in your MT index template after inserting your IP iformation:

<?
$ip = $REMOTE_ADDR;
if ($ip == “IP #1” || $ip == “IP #2“) {
print “<a href=\”<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&id=<$MTEntryID$>&blog_id=<$MTBlogID$>\” target=\”edit\” title=\”For me, not you\”>[edit]</a>”;
}
?>

(replace “IP #1″ and “IP #2″ with your IP address(s) that you want to be able to edit posts from)

Guest authored by:
Donna - deliriouscool.org

Converting entry dates to UTC in Movable Type with the PerlScript plugin

Saturday, May 17th, 2003

I was recently frustrated by Movable Type’s basic support of time zones. You can select a time zone as a number of hour plus or minus UTC, but there’s no adjustment for Daylight Savings Time, and entry dates and times are saved in whatever localtime was at the time. The default RSS 1.0 template just tacks on the +/- hours, a global setting. If you ware exporting a year’s worth of entries, there’s no way to get the correct time for both summer and winter entries.

I then remembered some perl functions that can convert times from local time to UTC and then to whatever timezone you want. A Unix system can keep track of DST, even from the past, so the new UTC times will be correct. With Brad Choate’s PerlScript plugin, you can put perl code right in your template. With 4 lines of code, I was able to print out a UTC date and time suitable for RSS.

<dc:date><MTPerlScript>
use Time::Local;
my $mytime = timelocal(<$MTEntryDate format=
“(’%S’, ‘%M’, ‘%H’, ‘%e’, ‘%m’-1, ‘%Y’-1900)”$>);
my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst)=gmtime($mytime);
printf(’%d-%02d-%02dT%02d:%02d:%02dZ’,
$year+1900,$mon+1,$mday,$hour,$min,$sec);
</MTPerlScript></dc:date>

A couple of notes. The arguments to timelocal are in quotes, since the values may have a leading 0 that will confuse perl. If your time zone is different from your server, you’ll have to adjust the %H parameter by the difference. Also, in perl months are numbered 0 to 11, and years are numbered from 1900, so we have to adjust accordingly. We then have a Unix timestamp in $mytime, and can obtain the individual components in UTC. I’m using printf for the output since the format for dc:date in RSS is so strict. Each %02d formats the output of an integer to two places padded with a 0 if necessary.

(This code was originally posted www.papascott.de/2003/05/17/2256.php)

Guest authored by:
Scott Hanson - papascott.de

Trackback ping fix

Sunday, April 27th, 2003

Samuel and I were talking the other night. We both use the SimpleComments plugin (combines Comments & Trackbacks in the same area).

We’d both noticed that pings don’t show up immediately unless you re-save the entry, so Samuel wrote a patch for it. The patch is written for MT 2.63 and is very easy to install (see his post for instructions).

prevent duplicate comments

Monday, April 14th, 2003

Here’s an MT hack that will prevent double comment posts.
[saw it at Lisa's]

(You can see the comment thread in the last post, but that Javascript method of disabling the button will not work - so this is rather timely!) :D

Comment Leaders and UPDATE statements

Friday, March 21st, 2003

Brenna released a new version (0.3) of the CommentLeaders plugin and so while I was up last night, I did some tweaking to make my list work a bit better. This tip would also be helpful if you are using the version from this site: Scripts: Show recent comments WITH total comments from that comment author (which is based on Comment Leader Board with PHP and MySQL).

See, when you’ve been blogging for as long as me, your blogging friends tend to have changing email addresses over the years and so it makes it hard to tally the top commenters! And besides, I have blogger and greymatter posts in there, and the GM posts didn’t require email address, so I have a lot of empty posts.

So I did some UPDATE statements in my MySQL database to make the newest addresses apply to all posts by that author. It took a little browsing through the database to see which ones needed changing, but I think I’ve got most of it. I didn’t bother changing any other information about the authors, just the email address for grouping correctly in the plugin output.

Here’s some examples in case you’d like to do some condensing too…
(more…)