Cool quick hack

The comment spammers have started hitting my Wife’s blog as well as mine recently… I’ve gotten her set up with MT-Blacklist and such too, which has helped some, but there are still some comments lurking in the background that she’d like to get rid of. Fortunately, there’s a really cool hack over at TheGirlieMatters which describes how to have your Movable Type main menu show more than the five most recent entries.

It’s some pretty nifty and handy code, so I hope she doesn’t mind if I quote her here in addition to linking to her:

The code is in lib/MT/App/CMS.pm, and all line numbers are based on v2.661.


Entries, lines 233-236:

my $iter = MT::Entry->load_iter({ blog_id => $blog_id },
{ 'sort' => 'created_on',
direction => 'descend',
limit => 5 });


Comments, lines 254-257:

$iter = MT::Comment->load_iter({ blog_id => $blog_id },
{ 'sort' => 'created_on',
direction => 'descend',
limit => 5 });


Pings, lines 272-275:

$iter = MT::TBPing->load_iter({ blog_id => $blog_id },
{ 'sort' => 'created_on',
direction => 'descend',
limit => 5 });

Change 5 to the number you want to display.

Leave a Reply

Your email address will not be published. Required fields are marked *