$block: the Block object that was saved
$user: the user who did the block (not the one being blocked)
+'EmailUser': before sending email from one user to another
+$to: address of receiving user
+$from: address of sending user
+$subject: subject of the mail
+$text: text of the mail
+
+'EmailUserComplete': after sending email from one user to another
+$to: address of receiving user
+$from: address of sending user
+$subject: subject of the mail
+$text: text of the mail
+
'UnknownAction': An unknown "action" has occured (useful for defining
your own actions)
$action: action name
return true;
}
+ function syslogEmailUser(&$to, &$from, &$subject, &$text) {
+ syslog(LOG_INFO, "Email sent from '$from' to '$to' with subject '$subject'");
+ }
+
# Setup -- called once environment is configured
function setupSyslog() {
$wgHooks['ArticleProtectComplete'][] = 'syslogArticleProtect';
$wgHooks['ArticleDeleteComplete'][] = 'syslogArticleDelete';
$wgHooks['ArticleSaveComplete'][] = 'syslogArticleSave';
+ $wgHooks['EmailUserComplete'][] = 'syslogEmailUser';
return true;
}
global $wgOut, $wgUser, $wgLang, $wgOutputEncoding;
$from = wfQuotedPrintable( $wgUser->getName() ) . " <" . $wgUser->getEmail() . ">";
+ $subject = wfQuotedPrintable( $this->subject );
- $mailResult = userMailer( $this->mAddress, $from, wfQuotedPrintable( $this->subject ), $this->text );
-
- if (! $mailResult)
- {
- $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
- $encTarget = wfUrlencode( $this->target );
- $wgOut->redirect( $titleObj->getFullURL( "target={$encTarget}&action=success" ) );
+ if (wfRunHooks('EmailUser', $this->mAddress, $from, $subject, $this->text)) {
+
+ $mailResult = userMailer( $this->mAddress, $from, $subject, $this->text );
+
+ if (!$mailResult) {
+ $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
+ $encTarget = wfUrlencode( $this->target );
+ $wgOut->redirect( $titleObj->getFullURL( "target={$encTarget}&action=success" ) );
+ wfRunHooks('EmailUserComplete', $this->mAddress, $from, $subject, $this->text);
+ } else {
+ $wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
+ }
}
- else
- $wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
}
function showSuccess() {