$user: user who performed the undeletion
$reason: reason
+'FormatUserMessage': Hook to format a message if you want to override
+the internal formatter.
+$subject: Title of the message.
+&$text: Text of the message.
+$signature: Signature that they would like to leave.
+
'GetAutoPromoteGroups': When determining which autopromote groups a user
is entitled to be in.
&$user: user to promote.
return $ret;
}
+ /**
+ * Format the user message using a hook, a template, or, failing these, a static format.
+ * @param $subject String the subject of the message
+ * @param $text String the content of the message
+ * @param $signature String the signature, if provided.
+ */
+ static protected function formatUserMessage( $subject, $text, $signature ) {
+ if ( wfRunHooks( 'FormatUserMessage',
+ array( $subject, &$text, $signature ) ) ) {
+
+ $signature = empty($signature) ? "~~~~~" : "{$signature} ~~~~~";
+
+ $template = Title::newFromText( wfMsg( 'usermessage-template' ) );
+ if ( !$template
+ || $template->getNamespace() !== NS_TEMPLATE
+ || !$template->exists() ) {
+ $text = "== $subject ==\n\n$text\n\n-- $signature"
+ } else {
+ $text = '{{'. $template->getText()
+ . " | subject=$subject | body=$text | signature=$signature }}";
+ }
+ }
+
+ return $text;
+ }
+
/**
* Leave a user a message
+ * @param $subject String the subject of the message
* @param $text String the message to leave
+ * @param $signature String Text to leave in the signature
* @param $summary String the summary for this change, defaults to
* "Leave system message."
* @param $article Article The article to update, defaults to the
wfRunHooks( 'SetupUserMessageArticle',
array( $this, &$article, $subject, $text, $signature, $summary, $editor ) );
+
+ $text = self::formatUserMessage( $subject, $text, $signature );
$flags = $article->checkFlags( $flags );
if ( $flags & EDIT_UPDATE ) {