MT3 With Threaded Comments and Threaded Comment Notification

Both threaded comments and threaded comment notification (lj-style) appear to be working for me with my new MT 3.14 install.

I installed the original plugins for both MTThreadMail and MTThreadedComments and then made the following changes:

% diff lib/MT/Comment.pm.orig lib/MT/Comment.pm
--- lib/MT/Comment.pm.orig Fri Jan 14 15:24:12 2005
+++ lib/MT/Comment.pm Fri Jan 14 15:41:33 2005
@@ -11,7 +11,7 @@
__PACKAGE__->install_properties({
columns => [
'id', 'blog_id', 'entry_id', 'author', 'commenter_id',
- 'visible', 'email', 'url', 'text', 'ip',
+ 'visible', 'email', 'url', 'text', 'ip', 'subject', 'parent_id', 'notify',
],
indexes => {
ip => 1,
@@ -21,6 +21,7 @@
email => 1,
commenter_id => 1,
visible => 1,
+ parent_id => 1,
},
audit => 1,
datasource => 'comment',


% diff lib/MT/App/Comments.pm.orig lib/MT/App/Comments.pm
--- lib/MT/App/Comments.pm.orig Fri Jan 14 15:22:12 2005
+++ lib/MT/App/Comments.pm Fri Jan 14 16:03:00 2005
@@ -365,6 +365,36 @@
$send_notfn_email = !$commenter_has_comment
&& !$comment->visible();
}
+ if ($q->param('parent_id'))
+ {
+ my $parent = MT::Comment->load($comment->parent_id);
+ if ($parent->notify)
+ {
+ my $comment_from_mail = $comment->author;
+ if( $comment_from_mail eq '' )
+ {
+ $comment_from_mail = 'webmaster@geeklair.net';
+ }
+ require MT::Mail;
+ my %head = ( To => $parent->email,
+ From => $comment_from_mail,
+ Subject =>
+ '[' . $blog->name . '] ' .
+ $app->translate('New Reply to Your Comment')
+ );
+ my $charset = $app->{cfg}->PublishCharset || 'iso-8859-1';
+ $head{'Content-Type'} = qq(text/plain; charset="$charset");
+ my $body = $app->translate( 'A new comment has been posted on to [_1], in response to your post to \'[_2]\'.',
+ $blog->name, $entry->title);
+ require Text::Wrap;
+ $Text::Wrap::cols = 72;
+ $body = Text::Wrap::wrap('', '', $body) . "\n$comment_link\n\n" .
+ $app->translate('From:') . ' ' . $comment->author . "\n" .
+ $app->translate('Subject:') . ' ' . $comment->subject . "\n\n" .
+ $app->translate('Comments:') . "\n\n" . $comment->text . "\n";
+ MT::Mail->send(\%head, $body);
+ }
+ }
if ($blog->email_new_comments || $send_notfn_email)
{
$app->_send_comment_notification($comment, $comment_link,
@@ -422,6 +452,9 @@
$comment->email(remove_html($email));
$comment->url(MT::Util::is_valid_url($url, 'stringent'));
$comment->text($q->param('text'));
+ $comment->subject($q->param('subject'));
+ $comment->parent_id($q->param('parent_id'));
+ $comment->notify($q->param('notify'));

return ($comment, $commenter);
}
@@ -464,6 +497,7 @@
(is_valid_email($comment->email)?
(comment_email => $comment->email):()),
comment_url => $comment->url,
+ comment_subject => $comment->subject,
comment_text => $comment->text,
unapproved => !$comment->visible(),
);
@@ -821,6 +855,8 @@

my $ctx = MT::Template::Context->new;
$ctx->stash('entry', $entry);
+ $ctx->stash('comment_parent_id', $q->param('parent_id'));
+ $ctx->stash('comment_notify', $q->param('notify'));
$ctx->stash('commenter', $cmntr) if ($cmntr);
$ctx->{current_timestamp} = $entry->created_on;
my %cond = (

Powered by Movable Type 4.34-en
Creative Commons License
This blog is licensed under a Creative Commons License.