MediaWiki REL1_40
MediaWiki\Mail\EmailUser Class Reference

Command for sending emails to users. More...

Static Public Member Functions

static getPermissionsError ( $user, $editToken, Config $config=null)
 Check whether a user is allowed to send email.
 
static getTarget ( $target, User $sender)
 Validate target User.
 
static submit (array $data, IContextSource $context)
 Really send a mail.
 
static validateTarget ( $target, User $sender)
 Validate target User.
 

Detailed Description

Command for sending emails to users.

Since
1.40
Stability: unstable

Definition at line 43 of file EmailUser.php.

Member Function Documentation

◆ getPermissionsError()

static MediaWiki\Mail\EmailUser::getPermissionsError ( $user,
$editToken,
Config $config = null )
static

Check whether a user is allowed to send email.

Parameters
User$user
string$editToken
Config | null$configoptional for backwards compatibility
Returns
null|string|array Null on success, string on error, or array on hook error

Definition at line 131 of file EmailUser.php.

References MediaWiki\MainConfigNames\EnableEmail, MediaWiki\MainConfigNames\EnableUserEmail, MediaWiki\MediaWikiServices\getInstance(), and wfDebug().

◆ getTarget()

static MediaWiki\Mail\EmailUser::getTarget ( $target,
User $sender )
static

Validate target User.

Parameters
string$targetTarget user name
User$senderUser sending the email
Returns
User|string User object on success or a string on error

Definition at line 51 of file EmailUser.php.

References User\newFromName(), MediaWiki\Mail\EmailUser\validateTarget(), and wfDebug().

Referenced by MediaWiki\Mail\EmailUser\submit().

◆ submit()

static MediaWiki\Mail\EmailUser::submit ( array $data,
IContextSource $context )
static

Really send a mail.

Permissions should have been checked using getPermissionsError(). It is probably also a good idea to check the edit token and ping limiter in advance.

Parameters
array$data
IContextSource$context
Returns
Status|false
Exceptions
MWExceptionif EmailUser hook sets the error to something unsupported

Definition at line 186 of file EmailUser.php.

References $type, MediaWiki\MainConfigNames\EnableSpecialMute, IContextSource\getConfig(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Mail\EmailUser\getTarget(), SpecialPage\getTitleFor(), IContextSource\getUser(), MessageLocalizer\msg(), MediaWiki\MainConfigNames\PasswordSender, and MediaWiki\MainConfigNames\UserEmailUseReplyTo.

◆ validateTarget()

static MediaWiki\Mail\EmailUser::validateTarget ( $target,
User $sender )
static

Validate target User.

Parameters
User$targetTarget user
User$senderUser sending the email
Returns
string Error message or empty string if valid.

Definition at line 71 of file EmailUser.php.

References User\getId(), MediaWiki\MediaWikiServices\getInstance(), User\isNewbie(), MediaWiki\Preferences\MultiUsernameFilter\splitIds(), and wfDebug().

Referenced by MediaWiki\Mail\EmailUser\getTarget().


The documentation for this class was generated from the following file: