Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Can I change subject and message [in email ], when vanilla send message to user

Can I change subject and message [in email ], when vanilla send message to user
I try to change in applications\dashboard\models\class.activitymodel.php

but no effect,

thanks,

Comments

  • Options

    thanks, :D

  • Options

    That tutorial describes how to modify the body of the email. I need to modify the Subject line.

    The rationale here is very simple. I have a support forum, and the engineers are cc'ed on new posts. When they see "user123 has started a discussion" there's no hook that draws them to read the email, and so they ignore it. If, on the other hand, the subject was "user123: How do I transgrominate the frooblizer?" they'd immediately know whether the post was in their area of expertise.

    I've got a few hacks that are making this happen, but, of course, the next time we upgrade I'll have to hack it again, which is suboptimal.

    Hopefully I just missed something in that tutorial. Going to read it again a few times ...

  • Options
    hgtonighthgtonight ∞ · New Moderator

    You should be able to hook in to the activity model before notifications are sent and modify the subject.

    public function ActivityModel_BeforeSendNotification_Handler($Sender) {
      $Email = $Sender->EventArguments['Email'];
    
      // Inspect the email subject and modify it to your purposes
    }
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    Followup: Thanks to @hgtonight, I've written the plugin that you can find at https://github.com/rbowen/VanillaMungeEmailSubject It can certainly stand to be improved, but scratches my immediate itch. I'm sure that someone more familiar with the Vanilla object model could make it more efficient, and I also want to get rid of the explicit references to activity type ID numbers, but for the moment, it works. Patches welcome.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    So... I was going to issue a pull request. In looking in to this, the headlines are stored in the database. Even better than that, they are run through the translate function.

    This means you can set them via definitions. Below are the defaults in a 2.0.18.8 installation.

    $Definition['Activity.RoleChange.FullHeadline'] = '%1$s changed %4$s permissions.';
    $Definition['Activity.RoleChange.ProfileHeadline'] = '%1$s changed %4$s permissions.';
    $Definition['Activity.ActivityComment.FullHeadline'] = '%1$s commented on %4$s %8$s.';
    $Definition['Activity.ActivityComment.ProfileHeadline'] = '%1$s';
    $Definition['Activity.Import.FullHeadline'] = '%1$s imported data.';
    $Definition['Activity.Import.ProfileHeadline'] = '%1$s imported data.';
    $Definition['Activity.ConversationMessage.FullHeadline'] = '%1$s sent you a %8$s.';
    $Definition['Activity.ConversationMessage.ProfileHeadline'] = '%1$s sent you a %8$s.';
    $Definition['Activity.AddedToConversation.FullHeadline'] = '%1$s added %3$s to a %8$s.';
    $Definition['Activity.AddedToConversation.ProfileHeadline'] = '%1$s added %3$s to a %8$s.';
    $Definition['Activity.DiscussionComment.FullHeadline'] = '%1$s commented on %4$s %8$s.';
    $Definition['Activity.DiscussionComment.ProfileHeadline'] = '%1$s commented on %4$s %8$s.';
    $Definition['Activity.DiscussionMention.FullHeadline'] = '%1$s mentioned %3$s in a %8$s.';
    $Definition['Activity.DiscussionMention.ProfileHeadline'] = '%1$s mentioned %3$s in a %8$s.';
    $Definition['Activity.CommentMention.FullHeadline'] = '%1$s mentioned %3$s in a %8$s.';
    $Definition['Activity.CommentMention.ProfileHeadline'] = '%1$s mentioned %3$s in a %8$s.';
    $Definition['Activity.BookmarkComment.FullHeadline'] = '%1$s commented on your %8$s.';
    $Definition['Activity.BookmarkComment.ProfileHeadline'] = '%1$s commented on your %8$s.';
    

    I also decided to figure out what variables are available.

    %1$s = Person doing the activity
    %2$s = Possesive form of the person doing the activity
    %3$s = Person activity was done upon
    %4$s = Possesive form of the person the activity was done upon
    %5$s = translated form of 'wall'
    %6$s = Gender of the person doing the activity
    %7$s = Gender of the person activity was done upon
    %8$s = The route code of the activity (can be used to create links)
    %9$s = Translated gender suffix
    %10$s = Link to the wall
    %11$s = Link to the activity
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    IF we had a %12s that was the activity subject line, that would be ideal. I wonder if that's a better place to aim the plugin?

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @rbowen said:
    IF we had a %12s that was the activity subject line, that would be ideal. I wonder if that's a better place to aim the plugin?

    What do you mean by that? There are 9 activities that have headlines: RoleChange, ActivityComment, Import, ConversationMessage, AddedToConversation, DiscussionComment, DiscussionMention, CommentMention, and BookmarkComment.

    You can set the actual headline to whatever you want through locale definitions.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    You can set them to a static string, right? Not to a runtime variable. Am I missing something? Can I do something there that sets it to the discussion subject line?

  • Options
    hgtonighthgtonight ∞ · New Moderator

    The discussion subject is not passed into activity headlines in 2.0.18.8, I do see it in later development versions though.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.