parent::__construct( 'Emailuser' );
}
+ public function getDescription() {
+ $target = self::getTarget( $this->mTarget );
+ if( !$target instanceof User ) {
+ return $this->msg( 'emailuser-title-notarget' )->text();
+ }
+
+ return $this->msg( 'emailuser-title-target', $target->getName() )->text();
+ }
+
protected function getFormFields() {
return array(
'From' => array(
}
public function execute( $par ) {
- $this->setHeaders();
- $this->outputHeader();
$out = $this->getOutput();
$out->addModuleStyles( 'mediawiki.special' );
+
$this->mTarget = is_null( $par )
? $this->getRequest()->getVal( 'wpTarget', $this->getRequest()->getVal( 'target', '' ) )
: $par;
+
+ // This needs to be below assignment of $this->mTarget because
+ // getDescription() needs it to determine the correct page title.
+ $this->setHeaders();
+ $this->outputHeader();
+
// error out if sending user cannot do this
$error = self::getPermissionsError( $this->getUser(), $this->getRequest()->getVal( 'wpEditToken' ) );
switch ( $error ) {
return false;
}
- $out->setPageTitle( $this->msg( 'emailpage' ) );
$result = $form->show();
if( $result === true || ( $result instanceof Status && $result->isGood() ) ) {
'mailnologin' => 'No send address',
'mailnologintext' => 'You must be [[Special:UserLogin|logged in]] and have a valid e-mail address in your [[Special:Preferences|preferences]] to send e-mail to other users.',
'emailuser' => 'E-mail this user',
+'emailuser-title-target' => 'E-mail this {{GENDER:$1|user}}',
+'emailuser-title-notarget' => 'E-mail user',
'emailuser-summary' => '', # do not translate or duplicate this message to other languages
'emailpage' => 'E-mail user',
'emailpagetext' => 'You can use the form below to send an e-mail message to this user.
* $2 is the number of group names in $1.',
# E-mail user
-'emailuser' => 'Link in the sidebar and title of [[Special:EmailUser|special page]]',
+'emailuser' => 'Link in the sidebar to send an e-mail to a user.',
+'emailuser-title-target' => 'Title of [[Special:EmailUser|special page]] when a user was given to e-mail. Parameters:
+* $1 is a plain text username, used for GENDER.',
+'emailuser-title-notarget' => 'Title of [[Special:EmailUser|special page]] when no user given to e-mail yet',
'emailpage' => "Title of special page [[Special:EmailUser]], when it is the destination of the sidebar link {{msg-mw|Emailuser}} on a user's page.",
'emailpagetext' => 'This is the text that is displayed above the e-mail form on [[Special:EmailUser]].
Special:EmailUser appears when you click on the link "E-mail this user" in the sidebar, but only if there is an e-mail address in the recipient\'s user preferences. If there isn\'t then the message [[Mediawiki:Noemailtext]] will appear instead of Special:EmailUser.',
-'defemailsubject' => 'The default subject of EmailUser emails. The first parameter is the username of the user sending the email.',
+'defemailsubject' => 'The default subject of EmailUser emails. Parameters:
+* $1 is the username of the user sending the email and can be used for GENDER.',
'usermaildisabled' => 'Caption for an error message ({{msg-mw|Usermaildisabledtext}}) shown when the user-to-user e-mail feature is disabled on the wiki (see [[mw:Manual:$wgEnableEmail]], [[mw:Manual:$wgEnableUserEmail]]).',
'noemailtitle' => 'The title of the message that appears instead of Special:EmailUser after clicking the "E-mail this user" link in the sidebar, if no e-mail can be sent to the user.',
'noemailtext' => 'The text of the message that appears in [[Special:EmailUser]] after clicking the "E-mail this user" link in the sidebar, if no e-mail can be sent to the user because he has not specified or not confirmed an e-mail address.',
'mailnologin',
'mailnologintext',
'emailuser',
+ 'emailuser-title-target',
+ 'emailuser-title-notarget',
'emailuser-summary',
'emailpage',
'emailpagetext',