2004年07月18日(日)

コメントとトラックバックの通知メールに編集用URLを

ブログに関するりばにしの記事

スパムコメントやスパムトラックバックの通知をメールで受けた際,それを削除するために該当するエントリーの編集画面に到達するまでが面倒だったので,通知メールに編集画面へのURLをつけることにしました.

参考にしたのはこちら.

僕は編集画面のURLが書いてあれば十分だったので,以下のように編集.

まず,「lib/MT/App/Comments.pm」.

$body = Text::Wrap::wrap('', '', $body) . "\n$link_url\n\n" .
$app->translate('IP Address:') . ' ' . $comment->ip . "\n" .
$app->translate('Name:') . ' ' . $comment->author . "\n" .
$app->translate('Email Address:') . ' ' . $comment->email . "\n" .
$app->translate('URL:') . ' ' . $comment->url . "\n\n" .
$app->translate('Comments:') . "\n\n" . $comment->text . "\n";
$body .= "\n--------\nEdit: " .
$app->{cfg}->CGIPath . "mt.cgi?__mode=view&_type=entry&" .
"blog_id=" . $blog->id . "&" .
"id=" . $entry->id . "\n";
MT::Mail->send(\%head, $body);

次に,「lib/MT/App/Trackback.pm」.

$body = Text::Wrap::wrap('', '', $body) . "\n\n" .
$app->translate('IP Address:') . ' ' . $ping->ip . "\n" .
$app->translate('URL:') . ' ' . $ping->source_url . "\n" .
$app->translate('Title:') . ' ' . $ping->title . "\n" .
$app->translate('Weblog:') . ' ' . $ping->blog_name . "\n\n" .
$app->translate('Excerpt:') . "\n" . $ping->excerpt . "\n";
$body .= "\n--------\nEdit: " .
$app->{cfg}->CGIPath . "mt.cgi?__mode=view&_type=entry&" .
"blog_id=" . $blog->id . "&" .
"id=" . $entry->id . "\n";
MT::Mail->send(\%head, $body);

ハイライトしている箇所が,変更した箇所.

無事,編集画面のURLが追加されるようになりました.

2005年01月14日:「Comments.pm」の部分が間違っていたので修正.

2004年07月18日02時11分 | Permalink | 1件のコメント | このエントリーを含むはてなブックマーク