HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

All email notifications

SS ✭✭
edited March 2010 in Feedback
I have a need to intercept all email messages (for admins) which sent by Garden to users. I want to make it configurable, that admins can choose what users activity they want to watch.

class Gdn_Email extends Pluggable, that is good. My first thought was change Subject() to xSubject() for plugins... but Subject() may accepts dynamic data such as date, names, etc. for one activity type, so this variant is unacceptable.

I'm thinking about new method similar to Subject but accept first param TranslateCode (sprintf string), next params are params for sprintf.

function NewSubject($Code){
$Args = func_get_args();
$Code = array_shift();
$this->EventArguments['SubjectCode'] =& $Code;
$this->FireEvent();
// ....
}


Any other ideas?
Tagged:

Comments

  • MarkMark Vanilla Staff
    All emails are handled by the activities. You could add a field to the activity table that flags activity types that admins want to know about, and then just send the message to admins as well.
  • SS ✭✭
    Probably, I'm not exactly said what I need.
    I'm talking about all emails (not activities only) created by Gdn_Email.

    Just simple script.
    $Email
    ->To($DataSet)
    ->Subject('Test ' . date('r'))
    ->Message('Test');
    ->Send();

    No AddActivity() or other tables here...
  • SS ✭✭
    If my script will use xSubject
    $Email
    ->To('xxx@xxx.xx')
    ->xSubject('Test %s', date('r'))
    ->Message('Message')
    ->Send();

    Plugin handlers:
    gdn_email_subject_before
    base_subject_before
    gdn_email_xsubject_after
    base_xsubject_after

    But I dislike something in this idea, still thinking...
Sign In or Register to comment.