6 Aug 2013 Rich   » (Master)

Vanilla Forums: Email subject lines

Problem: Vanilla Forums sends out email on new messages and when a message has been commented on. The subject line is:

[Forum Name] rbowen started a discussion


[Forum Name] rbowen commented on your bookmarked discussion

Because the actual forum post title is missing, the chance of someone actually responding is pretty low.

So, I want to modify the subject line. However, Vanilla doesn't provide a simple way to do this, so I'll have to hack on the code itself.

Seemed like a good idea to document this, since I see the question asked a few places, but no answers.


1) Track down where that subject line is created.

Looking for the various phrases, it appears that the subject lines are created in applications/vanilla/settings/structure.php, around line 180. Look for the comment:

// Insert some activity types

2) Where is the email sent?

After some digging, it appears that this is actually done in the EmailSubscribe plugin, which would have been more evident, I suppose, if I had been the one that set up the forum. Oh well.

The trouble is, however, that the subject line is created in applications/vanilla/settings/structure.php (around line 180) as part of the event logging, and so we may have to recreate the subject line ourselves, rather than using the one that's passed in.

Around line 79 of plugins/EMailSubscribe/default.php, you'll see:

$Email->Subject(sprintf(T('[%1$s] %2$s'), Gdn::Config('Garden.Title'), $ActivityHeadline)); and I think that's where I'm going to want to ctually set the subject line. If it's a new post, I want it to be POST_TITLE , whereas, if it's a reply to a post, I'll want to have it be: Re: POST_TITLE So, first pass is to just do this:

                        // $Email->Subject(sprintf(T('[%1$s] %2$s'), Gdn::Config('Garden.Title'), $ActivityHeadline));
                        $Email->Subject(sprintf(T('[%1$s] %2$s'), Gdn::Config('Garden.Title'), $DiscussionName));
But that leaves off the Re: for replies, so I need to figure out when it's a reply. I will defeat you, EMailSubscribe

Syndicated 2013-08-06 18:28:45 from Notes In The Margin

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!