Mephisto Comment Notification Mod

Posted by hank, Mon Mar 19 19:35:00 UTC 2007

I wanted to be able to click a link in my email to see the comment it talked about. So, I modified Luke Redpath’s Comment Notification Plugin to give that to me. First, I had to do some script/console action:


>> s = Site.find_first
=> #<Site:0xb747e014 @attributes={"current_theme_path"=>"wibbish-mephisto",#...
#...
>> s.host='www.ralree.info'
=> "www.ralree.info"
>> s.save
=> true
>> quit

Next, I did a small model modification:


# app/models/article.rb, in the public section
  def full_external_link
    ["http://", site.host, full_permalink].join("")
  end

And a slight test:


Loading production environment.
>> Article.find_first.full_external_link
=> "http://www.ralree.info/2006/5/21/first-post-what-to-say"

Perfect!

Then, I just modified the view for the email a bit:


# vendor/plugins/mephisto_comment_notification/lib/views/
# comment_notifier/comment_notification.rhtml
A new comment has been posted on your blog for the article '<%= @comment.article.title %>' by <%= @comment.author %> (<%= @comment.author_email %>):            
<%= @comment.article.full_external_link %>

The commenter IP address is <%= @comment.author_ip %>.

Here is the comment that was posted:

"<%= @comment.body %>"

This notification was sent using the Mephisto Comment notification plugin by Luke Redpath.
http://opensource.agileevolved.com/svn/root/rails_plugins/mephisto_comment_notification/trunk
Modified awesomely by Erik Gregg (http://www.ralree.info)

And it’s magic! It totally works!

Tags:

Comments