Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

  • Mark March 2010
  • S March 2010

Who's Online 13

G_MGumCloudericgilletteluc +9 guests

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?
Tagged:

Comments

  • Posts: 4,883
    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
    Posts: 459
    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
    Posts: 459
    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.