HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
All email notifications
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?
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:
0
Comments
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...
$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...